9
9
def test_hmac_sha1(self):
11
('0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b'.decode('hex'),
12
'Hi There', 'thcxhlUFcmTii8C2+zeMjvFGvgA='),
13
('Jefe', 'what do ya want for nothing?',
14
'7/zfauXrL6LSdBbV8YTfnCWafHk='),
15
('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'.decode('hex'),
16
'\xdd' * 50, 'El1zQrmsEc2Ro5r0iqF7T2PxddM='),
11
("0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b".decode("hex"),
12
"Hi There", "thcxhlUFcmTii8C2+zeMjvFGvgA="),
13
("Jefe", "what do ya want for nothing?",
14
"7/zfauXrL6LSdBbV8YTfnCWafHk="),
15
("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa".decode("hex"),
16
"\xdd" * 50, "El1zQrmsEc2Ro5r0iqF7T2PxddM="),
19
19
for key, data, expected in cases:
35
35
# The default port for HTTP is 80.
37
parse('http://127.0.0.1/'),
38
('http', '127.0.0.1', 80, '/'))
37
parse("http://127.0.0.1/"),
38
("http", "127.0.0.1", 80, "/"))
40
40
# The default port for HTTPS is 443.
42
parse('https://127.0.0.1/'),
43
('https', '127.0.0.1', 443, '/'))
42
parse("https://127.0.0.1/"),
43
("https", "127.0.0.1", 443, "/"))
45
45
# Specifying a port.
47
parse('http://spam:12345/'),
48
('http', 'spam', 12345, '/'))
47
parse("http://spam:12345/"),
48
("http", "spam", 12345, "/"))
50
50
# Weird (but commonly accepted) structure uses default port.
52
parse('http://spam:/'),
53
('http', 'spam', 80, '/'))
52
parse("http://spam:/"),
53
("http", "spam", 80, "/"))
55
55
# Spaces in the hostname are trimmed, the default path is /.
58
('http', 'foo', 80, '/'))
58
("http", "foo", 80, "/"))
60
60
def test_externalUnicodeInterference(self):
63
63
elements of its return tuple, even when passed an URL which has
64
64
previously been passed to L{urlparse} as a C{unicode} string.
66
badInput = u'http://example.com/path'
67
goodInput = badInput.encode('ascii')
66
badInput = u"http://example.com/path"
67
goodInput = badInput.encode("ascii")
69
69
scheme, host, port, path = parse(goodInput)
70
70
self.assertTrue(isinstance(scheme, str))