Beispiel #1
0
def test_parse_lookup():
    for actual, expected in {
        "echo(bar)": {"lookup_name": "echo", "lookup_args": ["bar"]},
        "echo(bar, baz)": {"lookup_name": "echo", "lookup_args": ["bar", "baz"]},
        "echo(bar, baz, boz)": {"lookup_name": "echo", "lookup_args": ["bar", "baz", "boz"]},
    }.iteritems():
        out_name, out_args = presence.parse_lookup(actual)
        assert out_name == expected["lookup_name"]
        assert out_args == expected["lookup_args"]
Beispiel #2
0
def test_parse_lookup():
    for actual, expected in {
            "echo(bar)": {
                'lookup_name': 'echo',
                'lookup_args': ['bar']
            },
            "echo(bar, baz)": {
                'lookup_name': 'echo',
                'lookup_args': ['bar', 'baz']
            },
            "echo(bar, baz, boz)": {
                'lookup_name': 'echo',
                'lookup_args': ['bar', 'baz', 'boz']
            }
    }.iteritems():
        out_name, out_args = presence.parse_lookup(actual)
        assert out_name == expected['lookup_name']
        assert out_args == expected['lookup_args']
Beispiel #3
0
def test_fail_parse_lookup_invalid_lookup_name():
    with pytest.raises(ValueError) as e:
        name, args = presence.parse_lookup("foo(bar)")
Beispiel #4
0
def test_fail_parse_lookup_invalid_lookup_name():
    with pytest.raises(ValueError) as e:
        name, args = presence.parse_lookup('foo(bar)')