diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2016-07-14 12:59:00 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2016-07-14 12:59:00 +1200 |
commit | 703c05066ec0bc05c680e24d368606791dd1c958 (patch) | |
tree | 6b83519d11994ec90e51fd038d57ab329300c6a4 /test | |
parent | cf3b3d206a22d47b4b5cc5ef57c09c7c577b27aa (diff) | |
download | mitmproxy-703c05066ec0bc05c680e24d368606791dd1c958.tar.gz mitmproxy-703c05066ec0bc05c680e24d368606791dd1c958.tar.bz2 mitmproxy-703c05066ec0bc05c680e24d368606791dd1c958.zip |
Fix indeterminacy in sticky cookie tests
How has this not bitten us before?
Diffstat (limited to 'test')
-rw-r--r-- | test/mitmproxy/builtins/test_stickycookie.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/test/mitmproxy/builtins/test_stickycookie.py b/test/mitmproxy/builtins/test_stickycookie.py index ddfaf5e0..e64ecb5b 100644 --- a/test/mitmproxy/builtins/test_stickycookie.py +++ b/test/mitmproxy/builtins/test_stickycookie.py @@ -64,8 +64,11 @@ class TestStickyCookie(mastertest.MasterTest): self._response(s, m, sc, c, "www.google.com") assert sc.jar.keys() - self._response(s, m, sc, "SSID=mooo", "www.google.com") - assert sc.jar.keys()[0] == ('www.google.com', 80, '/') + sc.jar.clear() + self._response( + s, m, sc, "SSID=mooo", "www.google.com" + ) + assert list(sc.jar.keys())[0] == ('www.google.com', 80, '/') def test_response_multiple(self): s, m, sc = self.mk() @@ -76,7 +79,7 @@ class TestStickyCookie(mastertest.MasterTest): f = self._response(s, m, sc, c1, "www.google.com") f.response.headers["Set-Cookie"] = c2 self.invoke(m, "response", f) - googlekey = sc.jar.keys()[0] + googlekey = list(sc.jar.keys())[0] assert len(sc.jar[googlekey].keys()) == 2 def test_response_weird(self): @@ -93,7 +96,7 @@ class TestStickyCookie(mastertest.MasterTest): for c in cs: f.response.headers["Set-Cookie"] = c self.invoke(m, "response", f) - googlekey = sc.jar.keys()[0] + googlekey = list(sc.jar.keys())[0] assert len(sc.jar[googlekey].keys()) == len(cs) def test_response_overwrite(self): @@ -105,9 +108,9 @@ class TestStickyCookie(mastertest.MasterTest): f = self._response(s, m, sc, c1, "www.google.com") f.response.headers["Set-Cookie"] = c2 self.invoke(m, "response", f) - googlekey = sc.jar.keys()[0] + googlekey = list(sc.jar.keys())[0] assert len(sc.jar[googlekey].keys()) == 1 - assert sc.jar[googlekey]["somecookie"].items()[0][1] == "newvalue" + assert list(sc.jar[googlekey]["somecookie"].items())[0][1] == "newvalue" def test_request(self): s, m, sc = self.mk() |