aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@corte.si>2017-04-30 14:42:37 +1200
committerAldo Cortesi <aldo@corte.si>2017-04-30 14:42:37 +1200
commitbefbe88d96865bb69134af2c7019d66e3a7a09fa (patch)
tree4d72b6e0b5032114a4254e1939946507803bd9a2 /test
parented62bbad1d7b0e7f3f948e2cc1503687edafc811 (diff)
downloadmitmproxy-befbe88d96865bb69134af2c7019d66e3a7a09fa.tar.gz
mitmproxy-befbe88d96865bb69134af2c7019d66e3a7a09fa.tar.bz2
mitmproxy-befbe88d96865bb69134af2c7019d66e3a7a09fa.zip
commands: cut.clip copies cuts to system clipboard
Diffstat (limited to 'test')
-rw-r--r--test/mitmproxy/addons/test_cut.py21
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()