mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-26 02:10:59 +00:00
Unit test request replay thread.
This is a small patch, but is the culmination of lots of work: we can now unit test the deep innards of mitmproxy, with coverage. There's a lot more to come in this vein.
This commit is contained in:
parent
e49c920d16
commit
aab45078ad
@ -1382,6 +1382,7 @@ class FlowMaster(controller.Master):
|
||||
self.masterq,
|
||||
)
|
||||
rt.start() # pragma: no cover
|
||||
return rt
|
||||
|
||||
def run_script_hook(self, name, *args, **kwargs):
|
||||
if self.script and not self.pause_scripts:
|
||||
|
@ -20,6 +20,16 @@ class SanityMixin:
|
||||
def test_large(self):
|
||||
assert len(self.pathod("200:b@50k").content) == 1024*50
|
||||
|
||||
def test_replay(self):
|
||||
assert self.pathod("304").status_code == 304
|
||||
assert len(self.master.state.view) == 1
|
||||
l = self.master.state.view[0]
|
||||
assert l.response.code == 304
|
||||
l.request.path = "/p/305"
|
||||
rt = self.master.replay_request(l)
|
||||
rt.join()
|
||||
assert l.response.code == 305
|
||||
|
||||
|
||||
class TestHTTP(tutils.HTTPProxTest, SanityMixin):
|
||||
def test_invalid_http(self):
|
||||
|
Loading…
Reference in New Issue
Block a user