split cookiejar as dict test
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Konstantin Podshumok · committed by Konstantin Podshumok · parent e6a32d6 · Browse files · 1 file·+64 added−2 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+64 added−2 removed
- other:+64 added−2 removed
Provenance
- Commit
b8f1263- Tree
0a59f8a- Author
Konstantin Podshumok <kpp.live@gmail.com>- Committer
Konstantin Podshumok <kpp.live@gmail.com>- Parent
e6a32d6
1 file changed+64 added−2 removed
modified:test_requests.py+64 added-2 removed
568 unmodified lines569 assert cookie.secure == secure570 assert cookie.domain == domain571 assert cookie._rest['HttpOnly'] == rest['HttpOnly']572 573- def test_cookie_as_dict(self):573+ def test_cookie_as_dict_keeps_len(self):574 key = 'some_cookie'575 value = 'some_value'576 577 key1 = 'some_cookie1'6 unmodified lines584 d1 = dict(jar)585 d2 = dict(jar.iteritems())586 d3 = dict(jar.items())587 588+ assert len(jar) == 2589 assert len(d1) == 2590 assert len(d2) == 2591 assert len(d3) == 2592 593+ def test_cookie_as_dict_keeps_items(self):594+ key = 'some_cookie'595+ value = 'some_value'596+597+ key1 = 'some_cookie1'598+ value1 = 'some_value1'599+600+ jar = requests.cookies.RequestsCookieJar()601+ jar.set(key, value)602+ jar.set(key1, value1)603+604+ d1 = dict(jar)605+ d2 = dict(jar.iteritems())606+ d3 = dict(jar.items())607+608 assert d1['some_cookie'] == 'some_value'609 assert d2['some_cookie'] == 'some_value'594- assert d3['some_cookie'] == 'some_value'610+ assert d3['some_cookie1'] == 'some_value1'611 612+ def test_cookie_as_dict_keys(self):613+ key = 'some_cookie'614+ value = 'some_value'615+616+ key1 = 'some_cookie1'617+ value1 = 'some_value1'618+619+ jar = requests.cookies.RequestsCookieJar()620+ jar.set(key, value)621+ jar.set(key1, value1)622+623 keys = jar.keys()624+ assert keys == list(keys)625+ # make sure one can use keys multiple times626 assert list(keys) == list(keys)627 628+ def test_cookie_as_dict_values(self):629+ key = 'some_cookie'630+ value = 'some_value'631+632+ key1 = 'some_cookie1'633+ value1 = 'some_value1'634+635+ jar = requests.cookies.RequestsCookieJar()636+ jar.set(key, value)637+ jar.set(key1, value1)638+639+ values = jar.values()640+ assert values == list(values)641+ # make sure one can use values multiple times642+ assert list(values) == list(values)643+644+ def test_cookie_as_dict_items(self):645+ key = 'some_cookie'646+ value = 'some_value'647+648+ key1 = 'some_cookie1'649+ value1 = 'some_value1'650+651+ jar = requests.cookies.RequestsCookieJar()652+ jar.set(key, value)653+ jar.set(key1, value1)654+655+ items = jar.items()656+ assert items == list(items)657+ # make sure one can use items multiple times658+ assert list(items) == list(items)659+660+661 def test_time_elapsed_blank(self):662 r = requests.get(httpbin('get'))663 td = r.elapsed664 total_seconds = ((td.microseconds + (td.seconds + td.days * 24 * 3600)492 unmodified lines