Example #1
0
def test_parse_invalid_args(input, message, capsys):
    with pytest.raises(SystemExit) as e:
        parse_args(input)

    # Arg parse always dies with an error code of 2.
    assert e.value.message == 2

    out, err = capsys.readouterr()
    assert message in err
Example #2
0
def test_parse_valid_args(input, expectations):
    args = parse_args(input)

    for key, expected in six.iteritems(expectations):
        assert expected == getattr(args, key)
Example #3
0
def test_parse_args(input, expected):
    args = parse_args(input.split())
    assert list(args.host) == expected[0]
    assert list(args.body) == expected[1]
    assert list(args.headers) == expected[2]
    assert args.profile == expected[3]
Example #4
0
def test_parse_valid_args(input, expectations):
    args = parse_args(input)

    for key, expected in expectations.iteritems():
        assert expected == getattr(args, key)
Example #5
0
def test_parse_args(input, expected):
    args = parse_args(input.split())
    assert list(args.host) == expected[0]
    assert list(args.body) == expected[1]
    assert list(args.headers) == expected[2]
    assert args.profile == expected[3]