Skip to content

Commit

Permalink
tests: python2.6 compat (assertIn added in 2.7)
Browse files Browse the repository at this point in the history
  • Loading branch information
randomir committed Aug 10, 2012
1 parent 40ba6b4 commit 4da4792
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tests/test_requests_ext.py
Expand Up @@ -110,21 +110,21 @@ def test_cookies_on_redirects(self):
s = requests.session()
s.get(url='http://tinyurl.com/preview.php?disable=1')
# we should have set a cookie for tinyurl: preview=0
self.assertIn('preview', s.cookies)
self.assertTrue('preview' in s.cookies)
self.assertEqual(s.cookies['preview'], '0')
self.assertEqual(list(s.cookies)[0].name, 'preview')
self.assertEqual(list(s.cookies)[0].domain, 'tinyurl.com')

# get cookies on another domain
r2 = s.get(url='http://httpbin.org/cookies')
# the cookie is not there
self.assertNotIn('preview', json.loads(r2.text)['cookies'])
self.assertTrue('preview' not in json.loads(r2.text)['cookies'])

# this redirects to another domain, httpbin.org
# cookies of the first domain should NOT be sent to the next one
r3 = s.get(url='http://tinyurl.com/7zp3jnr')
assert r3.url == 'http://httpbin.org/cookies'
self.assertNotIn('preview', json.loads(r2.text)['cookies'])
self.assertTrue('preview' not in json.loads(r2.text)['cookies'])

if __name__ == '__main__':
unittest.main()
Expand Down

0 comments on commit 4da4792

Please sign in to comment.