Пример #1
0
def test_version():
    here = dirname(__file__)
    fn = join(here, 'cheese_shop.py')
    with pytest.raises(SystemExit):
        args = cli().parse_args([fn, '--version'])
        assert args.version == 'tranquilizer {}'.format(__version__)
Пример #2
0
def test_secret_key():
    here = dirname(__file__)
    fn = join(here, 'protected.py')
    args = cli().parse_args([fn, '--secret-key', 'tranquilizer'])
    assert args.secret_key == 'tranquilizer'
Пример #3
0
def test_cors_args():
    here = dirname(__file__)
    fn = join(here, 'cheese_shop.py')
    args = cli().parse_args([fn, '--allow-origin', 'localhost', '--allow-origin', '127.0.0.1'])
    assert args.allow_origin == ['localhost', '127.0.0.1']
Пример #4
0
def test_debug():
    here = dirname(__file__)
    fn = join(here, 'cheese_shop.py')
    args = cli().parse_args([fn, '--debug'])
    assert args.debug == True
Пример #5
0
def test_url_prefix():
    here = dirname(__file__)
    fn = join(here, 'cheese_shop.py')
    args = cli().parse_args([fn, '--prefix', 'python'])
    assert args.prefix == 'python'
Пример #6
0
def test_py():
    here = dirname(__file__)
    fn = join(here, 'cheese_shop.py')
    args = cli().parse_args([fn])
    main(args)
Пример #7
0
def test_address():
    here = dirname(__file__)
    fn = join(here, 'cheese_shop.py')
    args = cli().parse_args([fn, '--address', '127.0.0.1'])
    assert args.address == '127.0.0.1'
Пример #8
0
def test_port():
    here = dirname(__file__)
    fn = join(here, 'cheese_shop.py')
    args = cli().parse_args([fn, '--port', '5000'])
    assert args.port == 5000
Пример #9
0
def test_max_content_length():
    here = dirname(__file__)
    fn = join(here, 'cheese_shop.py')
    args = cli().parse_args([fn, '--max_content_length', '1024'])
    assert args.max_content_length == 1024
Пример #10
0
def test_name():
    here = dirname(__file__)
    fn = join(here, 'cheese_shop.py')
    args = cli().parse_args([fn, '--name', 'cheese'])
    assert args.name == 'cheese'
Пример #11
0
def test_python():
    here = dirname(__file__)
    fn = join(here, 'cheese_shop.python')
    args = cli().parse_args([fn])
    with pytest.raises(UnsupportedFileType):
        main(args)