blob: 53091bc1486bb298d7b8a1e43433fe159ccf2679 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
import io
import pytest
from mitmproxy.test import taddons
from mitmproxy import ctx
@pytest.mark.asyncio
async def test_recordingmaster():
with taddons.context() as tctx:
assert not tctx.master.has_log("nonexistent")
ctx.log.error("foo")
assert not tctx.master.has_log("foo", level="debug")
assert await tctx.master.await_log("foo", level="error")
@pytest.mark.asyncio
async def test_dumplog():
with taddons.context() as tctx:
ctx.log.info("testing")
await ctx.master.await_log("testing")
s = io.StringIO()
tctx.master.dump_log(s)
assert s.getvalue()
def test_load_script(tdata):
with taddons.context() as tctx:
s = tctx.script(
tdata.path(
"mitmproxy/data/addonscripts/recorder/recorder.py"
)
)
assert s
|