Beispiel #1
0
def test_valid_simple_mode():
    base_path = cli.base_path()
    args = cli.args().parse_args(['--url', 'http://localhost',
                                  '--response-body', './foo.json'])
    config = cli.config(args)

    assert cli.simple_mode(config) == ["--host",
                                       "--port", "8080",
                                       "--bind-address", "0.0.0.0",
                                       "--script", "{}/scripts/simple.py http://localhost ./foo.json".format(base_path),
                                       "--quiet"]
Beispiel #2
0
def test_valid_simple_mode():
    base_path = cli.base_path()
    args = cli.args().parse_args(
        ['--url', 'http://localhost', '--response-body', './foo.json'])
    config = cli.config(args)
    expected = [
        "--host", "--port", "8080", "--bind-address", "0.0.0.0", "--script",
        "{}/scripts/simple.py".format(base_path) +
        " http://localhost ./foo.json", "--quiet"
    ]

    assert cli.simple_mode(config) == expected
Beispiel #3
0
def test_no_response_body_simple_mode():
    args = cli.args().parse_args(['--url', 'http://localhost'])
    config = cli.config(args)

    assert type(cli.simple_mode(config)) == Exception
Beispiel #4
0
def test_no_url_simple_mode():
    args = cli.args().parse_args(['--response-body', './foo.json'])
    config = cli.config(args)

    assert type(cli.simple_mode(config)) == Exception
Beispiel #5
0
def test_no_response_body_simple_mode():
    args = cli.args().parse_args(['--url', 'http://localhost'])
    config = cli.config(args)

    assert type(cli.simple_mode(config)) == Exception
Beispiel #6
0
def test_no_url_simple_mode():
    args = cli.args().parse_args(['--response-body', './foo.json'])
    config = cli.config(args)

    assert type(cli.simple_mode(config)) == Exception