aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorSteven Van Acker <StevenVanAcker@users.noreply.github.com>2016-04-22 20:16:05 +0200
committerMaximilian Hils <git@maximilianhils.com>2016-04-22 11:16:05 -0700
commit66267ad2768686f6af0ec20dfa89d1a281fc7f83 (patch)
treef6eee8c39adccefefd8410a56d8f4c07b17af5bf /test
parent3876a1f38c3f8109d6104546314c6a0876763ea1 (diff)
downloadmitmproxy-66267ad2768686f6af0ec20dfa89d1a281fc7f83.tar.gz
mitmproxy-66267ad2768686f6af0ec20dfa89d1a281fc7f83.tar.bz2
mitmproxy-66267ad2768686f6af0ec20dfa89d1a281fc7f83.zip
support for setting/sending multiple cookies (#1091)
* support for setting/sending multiple cookies * py.test for multiple cookie support
Diffstat (limited to 'test')
-rw-r--r--test/mitmproxy/test_flow.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/mitmproxy/test_flow.py b/test/mitmproxy/test_flow.py
index 60f6b1a9..8729cc77 100644
--- a/test/mitmproxy/test_flow.py
+++ b/test/mitmproxy/test_flow.py
@@ -69,6 +69,25 @@ class TestStickyCookieState:
s, f = self._response("SSID=mooo", "www.google.com")
assert s.jar.keys()[0] == ('www.google.com', 80, '/')
+ # Test setting of multiple cookies
+ c1 = "somecookie=test; Path=/"
+ c2 = "othercookie=helloworld; Path=/"
+ s, f = self._response(c1, "www.google.com")
+ f.response.headers["Set-Cookie"] = c2
+ s.handle_response(f)
+ googlekey = s.jar.keys()[0]
+ assert len(s.jar[googlekey].keys()) == 2
+
+ # Test overwriting of a cookie value
+ c1 = "somecookie=helloworld; Path=/"
+ c2 = "somecookie=newvalue; Path=/"
+ s, f = self._response(c1, "www.google.com")
+ f.response.headers["Set-Cookie"] = c2
+ s.handle_response(f)
+ googlekey = s.jar.keys()[0]
+ assert len(s.jar[googlekey].keys()) == 1
+ assert s.jar[googlekey]["somecookie"].value == "newvalue"
+
def test_handle_request(self):
s, f = self._response("SSID=mooo", "www.google.com")
assert "cookie" not in f.request.headers