mirror of
https://github.com/kennethreitz/requests.git
synced 2026-06-05 22:50:18 +00:00
Add tests to specify when CookieConflicError should be raised. References #3028.
This commit is contained in:
@@ -754,6 +754,28 @@ class TestRequests:
|
||||
# make sure one can use items multiple times
|
||||
assert list(items) == list(items)
|
||||
|
||||
def test_cookie_duplicate_names_different_domains(self):
|
||||
key = 'some_cookie'
|
||||
value = 'some_value'
|
||||
domain1 = 'test1.com'
|
||||
domain2 = 'test2.com'
|
||||
|
||||
jar = requests.cookies.RequestsCookieJar()
|
||||
jar.set(key, value, domain=domain1)
|
||||
jar.set(key, value, domain=domain2)
|
||||
assert key in jar
|
||||
|
||||
def test_cookie_duplicte_names_raises_cookie_conflict_error(self):
|
||||
key = 'some_cookie'
|
||||
value = 'some_value'
|
||||
path = 'some_path'
|
||||
|
||||
jar = requests.cookies.RequestsCookieJar()
|
||||
jar.set(key, value, path=path)
|
||||
jar.set(key, value)
|
||||
with pytest.raises(requests.cookies.CookieConflictError):
|
||||
jar.get(key)
|
||||
|
||||
def test_time_elapsed_blank(self, httpbin):
|
||||
r = requests.get(httpbin('get'))
|
||||
td = r.elapsed
|
||||
|
||||
Reference in New Issue
Block a user