mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2025-01-30 14:58:38 +00:00
Use custom Context object
This commit is contained in:
parent
6a4f1ae7c7
commit
d17cd5c6ec
@ -2,10 +2,13 @@ import json
|
|||||||
import netlib.tutils
|
import netlib.tutils
|
||||||
from . import tutils
|
from . import tutils
|
||||||
|
|
||||||
from mitmproxy import script, flow
|
|
||||||
from examples import har_extractor
|
from examples import har_extractor
|
||||||
|
|
||||||
|
|
||||||
|
class Context(object):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
trequest = netlib.tutils.treq(
|
trequest = netlib.tutils.treq(
|
||||||
timestamp_start=746203272,
|
timestamp_start=746203272,
|
||||||
timestamp_end=746203272,
|
timestamp_end=746203272,
|
||||||
@ -18,14 +21,11 @@ tresponse = netlib.tutils.tresp(
|
|||||||
|
|
||||||
|
|
||||||
def test_start():
|
def test_start():
|
||||||
fm = flow.FlowMaster(None, flow.State())
|
tutils.raises(ValueError, har_extractor.start, Context(), [])
|
||||||
ctx = script.ScriptContext(fm)
|
|
||||||
tutils.raises(ValueError, har_extractor.start, ctx, [])
|
|
||||||
|
|
||||||
|
|
||||||
def test_response():
|
def test_response():
|
||||||
fm = flow.FlowMaster(None, flow.State())
|
ctx = Context()
|
||||||
ctx = script.ScriptContext(fm)
|
|
||||||
ctx.HARLog = har_extractor._HARLog([])
|
ctx.HARLog = har_extractor._HARLog([])
|
||||||
ctx.seen_server = set()
|
ctx.seen_server = set()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user