aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_rparse.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2012-06-24 18:38:22 +1200
committerAldo Cortesi <aldo@nullcube.com>2012-06-24 18:38:22 +1200
commit2ac84be7cb0e4a17fd39c6155074a37161662593 (patch)
treefc66771b1fb313d6aa121484b140adacc9c831b8 /test/test_rparse.py
parentf8622ea914b506013625c539388349d53b4a7e58 (diff)
downloadmitmproxy-2ac84be7cb0e4a17fd39c6155074a37161662593.tar.gz
mitmproxy-2ac84be7cb0e4a17fd39c6155074a37161662593.tar.bz2
mitmproxy-2ac84be7cb0e4a17fd39c6155074a37161662593.zip
Add Path specification to request parser.
Diffstat (limited to 'test/test_rparse.py')
-rw-r--r--test/test_rparse.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/test/test_rparse.py b/test/test_rparse.py
index 2a76c3e8..5761d84a 100644
--- a/test/test_rparse.py
+++ b/test/test_rparse.py
@@ -88,9 +88,13 @@ class TestMisc:
assert rparse.Value.parseString('"val"')[0].val == "val"
assert rparse.Value.parseString('"\'val\'"')[0].val == "'val'"
+ def test_path(self):
+ e = rparse.Path.expr()
+ assert e.parseString('"/foo"')[0].value.val == "/foo"
+
def test_method(self):
e = rparse.Method.expr()
- assert e.parseString("get")[0].value == "GET"
+ assert e.parseString("get")[0].value.val == "GET"
assert e.parseString("'foo'")[0].value.val == "foo"
assert e.parseString("'get'")[0].value.val == "get"
@@ -189,9 +193,13 @@ class TestPauses:
class TestParseRequest:
+ def test_err(self):
+ tutils.raises(rparse.ParseException, rparse.parse_request, {}, 'GET')
+
def test_simple(self):
- r = rparse.parse_request({}, "GET")
+ r = rparse.parse_request({}, 'GET:"/foo"')
assert r.method == "GET"
+ assert r.path == "/foo"
class TestParseResponse: