Skip to content
Myr

Add Request.copy() test case.

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

authored by Robert Estelle · committed by Robert Estelle · parent ee90f0a · Browse files · 1 file+31 added−0 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+31 added−0 removed

  • other:+31 added−0 removed

1 file+31 added−0 removed

modified:test_requests.py+31 added
456 unmodified lines
457 resp = s.send(prep)458459 self.assertTrue(hasattr(resp, 'hook_working'))460461 def test_request_copy(self):462 a = requests.Request('POST', httpbin('post'),463 headers={'oh': 'gee'},464 files={'some': 'thing'},465 data={'baz':'qux'},466 params={'foo': 'bar'},467 auth=object(),468 cookies={'Some-Cookie':'Some Value'},469 hooks={'response': lambda r: r })470 b = a.copy()471472 self.assertNotEqual(a, b)473 self.assertEqual(a.method, b.method)474 self.assertEqual(a.url, b.url)475 self.assertEqual(a.headers, b.headers)476 self.assertEqual(a.files, b.files)477 self.assertEqual(a.data, b.data)478 self.assertEqual(a.params, b.params)479 self.assertEqual(a.auth, b.auth)480 self.assertEqual(a.cookies, b.cookies)481 self.assertEqual(a.hooks, b.hooks)482483 a.headers['Foo'] = 'Bar'484 self.assertNotEqual(a.headers, b.headers)485486 a.data['x'] = 'y'487 self.assertNotEqual(a.data, b.data)488489 a.params['_'] = '?'490 self.assertNotEqual(a.params, b.params)491492 def test_links(self):493 r = requests.Response()494 r.headers = {495 'cache-control': 'public, max-age=60, s-maxage=60',
325 unmodified lines