Skip to content
Myr

tests: python2.6 compat (`assertIn` added in 2.7)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Radomir Stevanovic · committed by Radomir Stevanovic · parent 40ba6b4 · Browse files · 1 file+3 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+3 added−3 removed

  • tests:+3 added−3 removed

1 file+3 added−3 removed

modified:tests/test_requests_ext.py+3 added-3 removed
108 unmodified lines
109 # get a cookie for tinyurl.com ONLY110 s = requests.session()111 s.get(url='http://tinyurl.com/preview.php?disable=1')112 # we should have set a cookie for tinyurl: preview=0113 self.assertIn('preview', s.cookies)113 self.assertTrue('preview' in s.cookies)114 self.assertEqual(s.cookies['preview'], '0')115 self.assertEqual(list(s.cookies)[0].name, 'preview')116 self.assertEqual(list(s.cookies)[0].domain, 'tinyurl.com')117118 # get cookies on another domain119 r2 = s.get(url='http://httpbin.org/cookies')120 # the cookie is not there121 self.assertNotIn('preview', json.loads(r2.text)['cookies'])121 self.assertTrue('preview' not in json.loads(r2.text)['cookies'])122123 # this redirects to another domain, httpbin.org124 # cookies of the first domain should NOT be sent to the next one125 r3 = s.get(url='http://tinyurl.com/7zp3jnr')126 assert r3.url == 'http://httpbin.org/cookies'127 self.assertNotIn('preview', json.loads(r2.text)['cookies'])127 self.assertTrue('preview' not in json.loads(r2.text)['cookies'])128129if __name__ == '__main__':130 unittest.main()131