Skip to content

Commit

Permalink
[1.5.x] Fixed httpwrappers tests under hash randomization
Browse files Browse the repository at this point in the history
Backport of 195bc37 from master
  • Loading branch information
aaugustin committed Oct 26, 2012
1 parent fbb6640 commit 1b4b0dc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tests/regressiontests/httpwrappers/tests.py
Expand Up @@ -149,7 +149,7 @@ def test_basic_mutable_operations(self):
self.assertEqual(q.setdefault('foo', 'bar'), 'bar') self.assertEqual(q.setdefault('foo', 'bar'), 'bar')
self.assertEqual(q['foo'], 'bar') self.assertEqual(q['foo'], 'bar')
self.assertEqual(q.getlist('foo'), ['bar']) self.assertEqual(q.getlist('foo'), ['bar'])
self.assertEqual(q.urlencode(), 'foo=bar&name=john') self.assertIn(q.urlencode(), ['foo=bar&name=john', 'name=john&foo=bar'])


q.clear() q.clear()
self.assertEqual(len(q), 0) self.assertEqual(len(q), 0)
Expand Down Expand Up @@ -266,14 +266,18 @@ def test_headers_type(self):
# The response also converts unicode or bytes keys to strings, but requires # The response also converts unicode or bytes keys to strings, but requires
# them to contain ASCII # them to contain ASCII
r = HttpResponse() r = HttpResponse()
del r['Content-Type']
r['foo'] = 'bar' r['foo'] = 'bar'
l = list(r.items()) l = list(r.items())
self.assertEqual(len(l), 1)
self.assertEqual(l[0], ('foo', 'bar')) self.assertEqual(l[0], ('foo', 'bar'))
self.assertIsInstance(l[0][0], str) self.assertIsInstance(l[0][0], str)


r = HttpResponse() r = HttpResponse()
del r['Content-Type']
r[b'foo'] = 'bar' r[b'foo'] = 'bar'
l = list(r.items()) l = list(r.items())
self.assertEqual(len(l), 1)
self.assertEqual(l[0], ('foo', 'bar')) self.assertEqual(l[0], ('foo', 'bar'))
self.assertIsInstance(l[0][0], str) self.assertIsInstance(l[0][0], str)


Expand Down

0 comments on commit 1b4b0dc

Please sign in to comment.