diff options
| author | Aldo Cortesi <aldo@corte.si> | 2017-04-30 17:37:45 +1200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-04-30 17:37:45 +1200 |
| commit | 50cfededce248fac5948a46a00de0bda17c27758 (patch) | |
| tree | d9a9a7fc7d4549904a6dad189e992ca9386aab24 /test | |
| parent | 51b50737e78d3530ecdd56014060b311cd56c0ea (diff) | |
| parent | befbe88d96865bb69134af2c7019d66e3a7a09fa (diff) | |
| download | mitmproxy-50cfededce248fac5948a46a00de0bda17c27758.tar.gz mitmproxy-50cfededce248fac5948a46a00de0bda17c27758.tar.bz2 mitmproxy-50cfededce248fac5948a46a00de0bda17c27758.zip | |
Merge pull request #2293 from cortesi/clip
commands: cut.clip copies cuts to system clipboard
Diffstat (limited to 'test')
| -rw-r--r-- | test/mitmproxy/addons/test_cut.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/mitmproxy/addons/test_cut.py b/test/mitmproxy/addons/test_cut.py index b4c0f66b..e028331f 100644 --- a/test/mitmproxy/addons/test_cut.py +++ b/test/mitmproxy/addons/test_cut.py @@ -7,6 +7,7 @@ from mitmproxy.test import taddons from mitmproxy.test import tflow from mitmproxy.test import tutils import pytest +from unittest import mock def test_extract(): @@ -101,6 +102,26 @@ def qr(f): return fp.read() +def test_cut_clip(): + v = view.View() + c = cut.Cut() + with taddons.context() as tctx: + tctx.master.addons.add(v, c) + v.add([tflow.tflow(resp=True)]) + + with mock.patch('pyperclip.copy') as pc: + tctx.command(c.clip, "q.method|@all") + assert pc.called + + with mock.patch('pyperclip.copy') as pc: + tctx.command(c.clip, "q.content|@all") + assert pc.called + + with mock.patch('pyperclip.copy') as pc: + tctx.command(c.clip, "q.method,q.content|@all") + assert pc.called + + def test_cut_file(tmpdir): f = str(tmpdir.join("path")) v = view.View() |
