def test_parse_auth_params_bad_whitespace():
    from webob.descriptors import parse_auth_params
    assert parse_auth_params('a= "2 ", b =3, c=4 ') == {
        'a': '2 ',
        'b': '3',
        'c': '4'
    }
Exemple #2
0
def test_parse_auth_params_bad_whitespace():
    from webob.descriptors import parse_auth_params
    assert parse_auth_params('a= "2 ", b =3, c=4 ') == {
        'a': '2 ',
        'b': '3',
        'c': '4'
    }
Exemple #3
0
def test_authorization2():
    from webob.descriptors import parse_auth_params
    for s, d in [
        ('x=y', {
            'x': 'y'
        }),
        ('x="y"', {
            'x': 'y'
        }),
        ('x=y,z=z', {
            'x': 'y',
            'z': 'z'
        }),
        ('x=y, z=z', {
            'x': 'y',
            'z': 'z'
        }),
        ('x="y",z=z', {
            'x': 'y',
            'z': 'z'
        }),
        ('x="y", z=z', {
            'x': 'y',
            'z': 'z'
        }),
        ('x="y,x", z=z', {
            'x': 'y,x',
            'z': 'z'
        }),
    ]:
        assert parse_auth_params(s) == d
Exemple #4
0
def test_authorization2():
    from webob.descriptors import parse_auth_params

    for s, d in [
        ("x=y", {
            "x": "y"
        }),
        ('x="y"', {
            "x": "y"
        }),
        ("x=y,z=z", {
            "x": "y",
            "z": "z"
        }),
        ("x=y, z=z", {
            "x": "y",
            "z": "z"
        }),
        ('x="y",z=z', {
            "x": "y",
            "z": "z"
        }),
        ('x="y", z=z', {
            "x": "y",
            "z": "z"
        }),
        ('x="y,x", z=z', {
            "x": "y,x",
            "z": "z"
        }),
    ]:
        assert parse_auth_params(s) == d
Exemple #5
0
def test_parse_auth_params_multiple_values():
    from webob.descriptors import parse_auth_params
    val = parse_auth_params("foo='blah &&234', qop=foo, nonce='qwerty1234'")
    assert val == {
        'nonce': "'qwerty1234'",
        'foo': "'blah &&234'",
        'qop': 'foo'
    }
Exemple #6
0
def test_parse_auth_params_bad_whitespace():
    from webob.descriptors import parse_auth_params

    assert parse_auth_params('a= "2 ", b =3, c=4 ') == {
        "a": "2 ",
        "b": "3",
        "c": "4"
    }
Exemple #7
0
def test_parse_auth_params_multiple_values():
    from webob.descriptors import parse_auth_params

    val = parse_auth_params("foo='blah &&234', qop=foo, nonce='qwerty1234'")
    assert val == {
        "nonce": "'qwerty1234'",
        "foo": "'blah &&234'",
        "qop": "foo"
    }
def test_authorization2():
    from webob.descriptors import parse_auth_params
    for s, d in [
            ('x=y', {'x': 'y'}),
            ('x="y"', {'x': 'y'}),
            ('x=y,z=z', {'x': 'y', 'z': 'z'}),
            ('x=y, z=z', {'x': 'y', 'z': 'z'}),
            ('x="y",z=z', {'x': 'y', 'z': 'z'}),
            ('x="y", z=z', {'x': 'y', 'z': 'z'}),
            ('x="y,x", z=z', {'x': 'y,x', 'z': 'z'}),
            ]:
        assert parse_auth_params(s) == d
def test_authorization2():
    from webob.descriptors import parse_auth_params

    for s, d in [
        ("x=y", {"x": "y"}),
        ('x="y"', {"x": "y"}),
        ("x=y,z=z", {"x": "y", "z": "z"}),
        ("x=y, z=z", {"x": "y", "z": "z"}),
        ('x="y",z=z', {"x": "y", "z": "z"}),
        ('x="y", z=z', {"x": "y", "z": "z"}),
        ('x="y,x", z=z', {"x": "y,x", "z": "z"}),
    ]:
        eq_(parse_auth_params(s), d)
Exemple #10
0
def test_parse_auth_params_truncate_on_comma():
    from webob.descriptors import parse_auth_params
    val = parse_auth_params("Basic realm=WebOb,this_will_truncate")
    eq_(val, {'realm': 'WebOb'})
def test_parse_auth_params_leading_capital_letter():
    from webob.descriptors import parse_auth_params

    val = parse_auth_params("Basic Realm=WebOb")
    eq_(val, {"ealm": "WebOb"})
def test_parse_auth_params_emptystr():
    from webob.descriptors import parse_auth_params
    assert parse_auth_params('') == {}
def test_parse_auth_params_truncate_on_comma():
    from webob.descriptors import parse_auth_params
    val = parse_auth_params("Basic realm=WebOb,this_will_truncate")
    assert val == {'realm': 'WebOb'}
def test_parse_auth_params_multiple_values():
    from webob.descriptors import parse_auth_params
    val = parse_auth_params("foo='blah &&234', qop=foo, nonce='qwerty1234'")
    assert val == {'nonce': "'qwerty1234'", 'foo': "'blah &&234'", 'qop': 'foo'}
def test_parse_auth_params_multiple_values():
    from webob.descriptors import parse_auth_params

    val = parse_auth_params("foo='blah &&234', qop=foo, nonce='qwerty1234'")
    eq_(val, {"nonce": "'qwerty1234'", "foo": "'blah &&234'", "qop": "foo"})
def test_parse_auth_params_truncate_on_comma():
    from webob.descriptors import parse_auth_params

    val = parse_auth_params("Basic realm=WebOb,this_will_truncate")
    eq_(val, {"realm": "WebOb"})
Exemple #17
0
def test_parse_auth_params_truncate_on_comma():
    from webob.descriptors import parse_auth_params

    val = parse_auth_params("Basic realm=WebOb,this_will_truncate")
    assert val == {"realm": "WebOb"}
Exemple #18
0
def test_parse_auth_params_doublequotes():
    from webob.descriptors import parse_auth_params

    val = parse_auth_params('Basic realm="Web Object"')
    assert val == {"realm": "Web Object"}
Exemple #19
0
def test_parse_auth_params_leading_capital_letter():
    from webob.descriptors import parse_auth_params

    val = parse_auth_params("Basic Realm=WebOb")
    assert val == {"ealm": "WebOb"}
Exemple #20
0
def test_parse_auth_params_doublequotes():
    from webob.descriptors import parse_auth_params
    val = parse_auth_params('Basic realm="Web Object"')
    eq_(val, {'realm': 'Web Object'})
Exemple #21
0
def test_parse_auth_params_trailing_capital_letter():
    from webob.descriptors import parse_auth_params
    val = parse_auth_params('Basic realM=WebOb')
    eq_(val, {})
Exemple #22
0
def test_parse_auth_params_leading_capital_letter():
    from webob.descriptors import parse_auth_params
    val = parse_auth_params('Basic Realm=WebOb')
    eq_(val, {'ealm': 'WebOb'})
Exemple #23
0
def test_parse_auth_params_emptystr():
    from webob.descriptors import parse_auth_params
    eq_(parse_auth_params(''), {})
def test_parse_auth_params_bad_whitespace():
    from webob.descriptors import parse_auth_params

    eq_(parse_auth_params('a= "2 ", b =3, c=4 '), {"a": "2 ", "b": "3", "c": "4"})
Exemple #25
0
def test_parse_auth_params_trailing_capital_letter():
    from webob.descriptors import parse_auth_params

    val = parse_auth_params("Basic realM=WebOb")
    assert val == {}
Exemple #26
0
def test_parse_auth_params_emptystr():
    from webob.descriptors import parse_auth_params
    eq_(parse_auth_params(''), {})
def test_parse_auth_params_trailing_capital_letter():
    from webob.descriptors import parse_auth_params

    val = parse_auth_params("Basic realM=WebOb")
    eq_(val, {})
def test_parse_auth_params_trailing_capital_letter():
    from webob.descriptors import parse_auth_params
    val = parse_auth_params('Basic realM=WebOb')
    assert val == {}
Exemple #29
0
def test_parse_auth_params_emptystr():
    from webob.descriptors import parse_auth_params

    assert parse_auth_params("") == {}
def test_parse_auth_params_doublequotes():
    from webob.descriptors import parse_auth_params
    val = parse_auth_params('Basic realm="Web Object"')
    assert val == {'realm': 'Web Object'}
def test_parse_auth_params_leading_capital_letter():
    from webob.descriptors import parse_auth_params
    val = parse_auth_params('Basic Realm=WebOb')
    assert val == {'ealm': 'WebOb'}
def test_parse_auth_params_doublequotes():
    from webob.descriptors import parse_auth_params

    val = parse_auth_params('Basic realm="Web Object"')
    eq_(val, {"realm": "Web Object"})