def test_serialize_auth_digest_multiple(): from webob.descriptors import serialize_auth val = serialize_auth(("Digest", 'realm="WebOb", nonce=abcde12345, qop=foo')) flags = val[len("Digest") :] result = sorted([x.strip() for x in flags.split(",")]) eq_(result, ["nonce=abcde12345", "qop=foo", 'realm="WebOb"'])
def test_serialize_auth_digest_tuple(): from webob.descriptors import serialize_auth val = serialize_auth(("Digest", {"realm": '"WebOb"', "nonce": "abcde12345", "qop": "foo"})) flags = val[len("Digest") :] result = sorted([x.strip() for x in flags.split(",")]) eq_(result, ['nonce="abcde12345"', 'qop="foo"', 'realm=""WebOb""'])
def test_serialize_auth_digest_multiple(): from webob.descriptors import serialize_auth val = serialize_auth( ('Digest', 'realm="WebOb", nonce=abcde12345, qop=foo')) flags = val[len('Digest'):] result = sorted([x.strip() for x in flags.split(',')]) eq_(result, ['nonce=abcde12345', 'qop=foo', 'realm="WebOb"'])
def test_serialize_auth_digest_multiple(): from webob.descriptors import serialize_auth val = serialize_auth(("Digest", 'realm="WebOb", nonce=abcde12345, qop=foo')) flags = val[len("Digest") :] result = sorted([x.strip() for x in flags.split(",")]) assert result == ["nonce=abcde12345", "qop=foo", 'realm="WebOb"']
def test_serialize_auth_digest_tuple(): from webob.descriptors import serialize_auth val = serialize_auth( ("Digest", {"realm": '"WebOb"', "nonce": "abcde12345", "qop": "foo"}) ) flags = val[len("Digest") :] result = sorted([x.strip() for x in flags.split(",")]) assert result == ['nonce="abcde12345"', 'qop="foo"', 'realm=""WebOb""']
def test_serialize_auth_digest_tuple(): from webob.descriptors import serialize_auth val = serialize_auth(('Digest', { 'realm': '"WebOb"', 'nonce': 'abcde12345', 'qop': 'foo' })) flags = val[len('Digest'):] result = sorted([x.strip() for x in flags.split(',')]) eq_(result, ['nonce="abcde12345"', 'qop="foo"', 'realm=""WebOb""'])
def test_serialize_auth_parsed_known_nospace(): from webob.descriptors import serialize_auth assert serialize_auth(("Digest", {})) == "Digest "
def test_serialize_auth_parsed_emptystr(): from webob.descriptors import serialize_auth assert serialize_auth(("", "")) == " "
def test_serialize_auth_emptystr(): from webob.descriptors import serialize_auth assert serialize_auth("") == ""
def test_serialize_auth_digest_tuple(): from webob.descriptors import serialize_auth val = serialize_auth(('Digest', {'realm':'"WebOb"', 'nonce':'abcde12345', 'qop':'foo'})) flags = val[len('Digest'):] result = sorted([ x.strip() for x in flags.split(',') ]) assert result == ['nonce="abcde12345"', 'qop="foo"', 'realm=""WebOb""']
def test_serialize_auth_basic_quoted(): from webob.descriptors import serialize_auth val = serialize_auth(('Basic', 'realm="WebOb"')) assert val == 'Basic realm="WebOb"'
def test_serialize_auth_none(): from webob.descriptors import serialize_auth assert serialize_auth(None) is None
def test_serialize_auth_basic_quoted(): from webob.descriptors import serialize_auth val = serialize_auth(("Basic", 'realm="WebOb"')) eq_(val, 'Basic realm="WebOb"')
def test_serialize_auth_parsed_known_nospace(): from webob.descriptors import serialize_auth assert serialize_auth(('Digest', {})) == 'Digest '
def test_serialize_auth_parsed_unknown_nospace(): from webob.descriptors import serialize_auth assert serialize_auth(('NoSpace', '')) == 'NoSpace '
def test_serialize_auth_parsed_emptystr(): from webob.descriptors import serialize_auth assert serialize_auth(('', '')) == ' '
def test_serialize_auth_str(): from webob.descriptors import serialize_auth assert serialize_auth('some string') == 'some string'
def test_serialize_auth_emptystr(): from webob.descriptors import serialize_auth assert serialize_auth('') == ''
def test_serialize_auth_none(): from webob.descriptors import serialize_auth eq_(serialize_auth(None), None)
def test_serialize_auth_digest_multiple(): from webob.descriptors import serialize_auth val = serialize_auth(('Digest', 'realm="WebOb", nonce=abcde12345, qop=foo')) flags = val[len('Digest'):] result = sorted([ x.strip() for x in flags.split(',') ]) assert result == ['nonce=abcde12345', 'qop=foo', 'realm="WebOb"']
def test_serialize_auth_emptystr(): from webob.descriptors import serialize_auth eq_(serialize_auth(''), '')
def test_serialize_auth_str(): from webob.descriptors import serialize_auth assert serialize_auth("some string") == "some string"
def test_serialize_auth_parsed_unknown_nospace(): from webob.descriptors import serialize_auth assert serialize_auth(("NoSpace", "")) == "NoSpace "
def test_serialize_auth_basic_quoted(): from webob.descriptors import serialize_auth val = serialize_auth(('Basic', 'realm="WebOb"')) eq_(val, 'Basic realm="WebOb"')
def test_serialize_auth_basic_quoted(): from webob.descriptors import serialize_auth val = serialize_auth(("Basic", 'realm="WebOb"')) assert val == 'Basic realm="WebOb"'