aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorkira0204 <rshtmudgal@gmail.com>2018-03-06 05:44:05 +0530
committerkira0204 <rshtmudgal@gmail.com>2018-03-06 05:44:05 +0530
commitbe50f3f4810c70e0050a17cefee6a69bdc76e271 (patch)
tree453923ac21e68a71ecb1b17834a99886259c4d91 /test
parentc6802ba034d859a914bebddaa9e3214e15206d0e (diff)
downloadmitmproxy-be50f3f4810c70e0050a17cefee6a69bdc76e271.tar.gz
mitmproxy-be50f3f4810c70e0050a17cefee6a69bdc76e271.tar.bz2
mitmproxy-be50f3f4810c70e0050a17cefee6a69bdc76e271.zip
wrong additions
test-for-2850 few fixes mock testing Typo error
Diffstat (limited to 'test')
-rw-r--r--test/mitmproxy/test_command.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/mitmproxy/test_command.py b/test/mitmproxy/test_command.py
index e2b80753..ffbb20af 100644
--- a/test/mitmproxy/test_command.py
+++ b/test/mitmproxy/test_command.py
@@ -1,4 +1,5 @@
import typing
+from unittest import mock
from mitmproxy import command
from mitmproxy import flow
from mitmproxy import exceptions
@@ -309,6 +310,19 @@ class TDec:
pass
+def test_collect_commands():
+ """
+ This tests for the error thrown by hasattr()
+ """
+ with mock.patch("mitmproxy.command.hasattr") as mock_hasattr:
+ mock_hasattr.return_value = False
+ with taddons.context() as tctx:
+ mock_hasattr.side_effect = OSError
+ c = command.CommandManager(tctx.master)
+ a = TDec()
+ c.collect_commands(a)
+
+
def test_decorator():
with taddons.context() as tctx:
c = command.CommandManager(tctx.master)