Ejemplo n.º 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__)
Ejemplo n.º 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'
Ejemplo n.º 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']
Ejemplo n.º 4
0
def test_debug():
    here = dirname(__file__)
    fn = join(here, 'cheese_shop.py')
    args = cli().parse_args([fn, '--debug'])
    assert args.debug == True
Ejemplo n.º 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'
Ejemplo n.º 6
0
def test_py():
    here = dirname(__file__)
    fn = join(here, 'cheese_shop.py')
    args = cli().parse_args([fn])
    main(args)
Ejemplo n.º 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'
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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'
Ejemplo n.º 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)