aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_console.py
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2014-02-05 23:17:26 +0100
committerMaximilian Hils <git@maximilianhils.com>2014-02-05 23:17:26 +0100
commit80683e77bcb16b361e7eeaf6ad49048564d7acab (patch)
treec41341a7b06874a61ce2b4d660c9cac13946588b /test/test_console.py
parentf26d91cb814436fa5c1290459f5313e6831bd53c (diff)
downloadmitmproxy-80683e77bcb16b361e7eeaf6ad49048564d7acab.tar.gz
mitmproxy-80683e77bcb16b361e7eeaf6ad49048564d7acab.tar.bz2
mitmproxy-80683e77bcb16b361e7eeaf6ad49048564d7acab.zip
mock urwid to run console tests on windows, push failing testcases down to 0. :-)
Diffstat (limited to 'test/test_console.py')
-rw-r--r--test/test_console.py22
1 files changed, 10 insertions, 12 deletions
diff --git a/test/test_console.py b/test/test_console.py
index 20534177..0c5b4591 100644
--- a/test/test_console.py
+++ b/test/test_console.py
@@ -1,10 +1,9 @@
-import os
-from nose.plugins.skip import SkipTest
-if os.name == "nt":
- raise SkipTest("Skipped on Windows.")
-
+import os, sys, mock, gc
+from os.path import normpath
+import mock_urwid
from libmproxy import console
from libmproxy.console import common
+
import tutils
class TestConsoleState:
@@ -89,6 +88,7 @@ class TestConsoleState:
assert len(c.flowsettings) == 1
c.delete_flow(f)
del f
+ gc.collect()
assert len(c.flowsettings) == 0
@@ -107,19 +107,17 @@ def test_format_keyvals():
class TestPathCompleter:
def test_lookup_construction(self):
c = console._PathCompleter()
- assert c.complete("/tm") == "/tmp/"
- c.reset()
cd = tutils.test_data.path("completion")
ca = os.path.join(cd, "a")
- assert c.complete(ca).endswith("/completion/aaa")
- assert c.complete(ca).endswith("/completion/aab")
+ assert c.complete(ca).endswith(normpath("/completion/aaa"))
+ assert c.complete(ca).endswith(normpath("/completion/aab"))
c.reset()
ca = os.path.join(cd, "aaa")
- assert c.complete(ca).endswith("/completion/aaa")
- assert c.complete(ca).endswith("/completion/aaa")
+ assert c.complete(ca).endswith(normpath("/completion/aaa"))
+ assert c.complete(ca).endswith(normpath("/completion/aaa"))
c.reset()
- assert c.complete(cd).endswith("/completion/aaa")
+ assert c.complete(cd).endswith(normpath("/completion/aaa"))
def test_completion(self):
c = console._PathCompleter(True)