remove fancy test assertions that are unavailable on 2.6
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Shivaram Lingamneni · committed by Shivaram Lingamneni · parent 538de55 · Browse files · 1 file·+7 added−7 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+7 added−7 removed
- tests:+7 added−7 removed
Provenance
- Commit
a8555d8- Tree
327c51f- Author
Shivaram Lingamneni <slingamn@cs.stanford.edu>- Committer
Shivaram Lingamneni <slingamn@cs.stanford.edu>- Parent
538de55
1 file changed+7 added−7 removed
modified:tests/test_cookies.py+7 added-7 removed
36 unmodified lines37 """Cookies should not be sent to domains they didn't originate from."""38 r = requests.get("http://github.com")39 c = r.cookies40 # github should send us cookies41- self.assertGreaterEqual(len(c), 1)41+ self.assertTrue(len(c) >= 1)42 43 # github cookies should not be sent to httpbin.org:44 r2 = requests.get(httpbin('cookies'), cookies=c)45 self.assertEqual(json.loads(r2.text)['cookies'], {})46 47 # let's do this again using the session object48 s = requests.session()49 s.get("http://github.com")50- self.assertGreaterEqual(len(s.cookies), 1)50+ self.assertTrue(len(s.cookies) >= 1)51 r = s.get(httpbin('cookies'))52 self.assertEqual(json.loads(r.text)['cookies'], {})53 # we can set a cookie and get exactly that same-domain cookie back:54 r = s.get(httpbin('cookies', 'set', 'myname', 'myvalue'))23 unmodified lines78 79 r2 = requests.get(httpbin('cookies', 'set', 'very', 'well'), cookies=r.cookies)80 expected_cookies = {'redirects': 'work', 'very': 'well'}81 self.assertEqual(json.loads(r2.text)['cookies'], expected_cookies)82- self.assertIs(r.cookies, r2.cookies)82+ self.assertTrue(r.cookies is r2.cookies)83 84 def test_none_cookie(self):85 """Regression test: don't send a Cookie header with a string value of 'None'!"""86 page = json.loads(requests.get(httpbin('headers')).text)87- self.assertNotIn('Cookie', page['headers'])87+ self.assertTrue('Cookie' not in page['headers'])88 89 class LWPCookieJarTest(TestBaseMixin, unittest.TestCase):90 """Check store/load of cookies to FileCookieJar's, specifically LWPCookieJar's."""91 49 unmodified lines141 142 # github sets a cookie143 requests.get("http://github.com", cookies=cookiejar)144 num_github_cookies = len(cookiejar)145- self.assertGreaterEqual(num_github_cookies, 1)145+ self.assertTrue(num_github_cookies >= 1)146 # httpbin sets another147 requests.get(httpbin('cookies', 'set', 'key', 'value'), cookies=cookiejar)148 num_total_cookies = len(cookiejar)149- self.assertGreaterEqual(num_total_cookies, 2)150- self.assertGreater(num_total_cookies, num_github_cookies)149+ self.assertTrue(num_total_cookies >= 2)150+ self.assertTrue(num_total_cookies > num_github_cookies)151 152 # save and load153 cookiejar.save(ignore_discard=True)154 cookiejar_2 = self.COOKIEJAR_CLASS(self.cookiejar_filename)12 unmodified lines