mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-25 09:37:37 +00:00
parent
a6f673fb29
commit
550e1a4ab3
@ -1,4 +1,3 @@
|
||||
import asyncio
|
||||
from dataclasses import dataclass
|
||||
|
||||
from mitmproxy import hooks
|
||||
@ -61,7 +60,7 @@ class Log:
|
||||
self(txt, "error")
|
||||
|
||||
def __call__(self, text, level="info"):
|
||||
asyncio.get_event_loop().call_soon(
|
||||
self.master.event_loop.call_soon_threadsafe(
|
||||
self.master.addons.trigger, AddLogHook(LogEntry(text, level)),
|
||||
)
|
||||
|
||||
|
@ -40,13 +40,13 @@ class TestCommandHistory:
|
||||
|
||||
def test_add_command(self):
|
||||
ch = command_history.CommandHistory()
|
||||
with taddons.context(ch):
|
||||
ch.add_command('cmd1')
|
||||
ch.add_command('cmd2')
|
||||
assert ch.history == ['cmd1', 'cmd2']
|
||||
|
||||
ch.add_command('cmd1')
|
||||
ch.add_command('cmd2')
|
||||
assert ch.history == ['cmd1', 'cmd2']
|
||||
|
||||
ch.add_command('')
|
||||
assert ch.history == ['cmd1', 'cmd2']
|
||||
ch.add_command('')
|
||||
assert ch.history == ['cmd1', 'cmd2']
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_add_command_failed(self):
|
||||
|
Loading…
Reference in New Issue
Block a user