aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_language.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2012-10-05 11:23:30 +1300
committerAldo Cortesi <aldo@nullcube.com>2012-10-05 11:23:30 +1300
commite83392bfc8e44323c326e0a677210b9c1e6a3268 (patch)
tree1efa113128ceb906f44fa175d3efb1236fe395f3 /test/test_language.py
parent495daf2b641d14bbe8d7cab1482e12e8c8d7ea1b (diff)
downloadmitmproxy-e83392bfc8e44323c326e0a677210b9c1e6a3268.tar.gz
mitmproxy-e83392bfc8e44323c326e0a677210b9c1e6a3268.tar.bz2
mitmproxy-e83392bfc8e44323c326e0a677210b9c1e6a3268.zip
Start making Action objects more sophisticated.
Diffstat (limited to 'test/test_language.py')
-rw-r--r--test/test_language.py18
1 files changed, 15 insertions, 3 deletions
diff --git a/test/test_language.py b/test/test_language.py
index 0668fba2..7680492f 100644
--- a/test/test_language.py
+++ b/test/test_language.py
@@ -168,6 +168,18 @@ class TestMisc:
s.serve(d)
+class Test_Action:
+ def test_cmp(self):
+ a = language._Action(0)
+ b = language._Action(1)
+ c = language._Action(0)
+ assert a < b
+ assert a == c
+ l = [b, a]
+ l.sort()
+ assert l[0].offset == 0
+
+
class TestDisconnects:
def test_parse_response(self):
assert (0, "disconnect") in language.parse_response({}, "400:d0").actions
@@ -177,14 +189,14 @@ class TestDisconnects:
e = language.DisconnectAt.expr()
v = e.parseString("d0")[0]
assert isinstance(v, language.DisconnectAt)
- assert v.value == 0
+ assert v.offset == 0
v = e.parseString("d100")[0]
- assert v.value == 100
+ assert v.offset == 100
e = language.DisconnectAt.expr()
v = e.parseString("dr")[0]
- assert v.value == "r"
+ assert v.offset == "r"
class TestInject: