diff options
| author | Aldo Cortesi <aldo@nullcube.com> | 2012-04-29 12:05:38 +1200 |
|---|---|---|
| committer | Aldo Cortesi <aldo@nullcube.com> | 2012-04-29 12:05:38 +1200 |
| commit | 2d88d88f8c27b50f5d4d532ae54a8c643e6dc868 (patch) | |
| tree | 939eca7007597411b56c5990456f27f921798fa0 /test | |
| parent | 7ca5c7ae90c32cfc238d893eb302acc06deb2e70 (diff) | |
| download | mitmproxy-2d88d88f8c27b50f5d4d532ae54a8c643e6dc868.tar.gz mitmproxy-2d88d88f8c27b50f5d4d532ae54a8c643e6dc868.tar.bz2 mitmproxy-2d88d88f8c27b50f5d4d532ae54a8c643e6dc868.zip | |
Basic anchor adding.
Diffstat (limited to 'test')
| -rw-r--r-- | test/test_app.py | 14 | ||||
| -rw-r--r-- | test/test_utils.py | 6 |
2 files changed, 15 insertions, 5 deletions
diff --git a/test/test_app.py b/test/test_app.py index 6355a88a..3a147385 100644 --- a/test/test_app.py +++ b/test/test_app.py @@ -2,8 +2,14 @@ import libpry from libpathod import app from tornado import httpserver - class uApplication(libpry.AutoTree): + def test_anchors(self): + a = app.PathodApp(staticdir=None) + a.add_anchor("/foo", "200") + assert a.handlers[0][1][0].handler_class.__name__ == "FixedPathod" + + +class uPages(libpry.AutoTree): def dummy_page(self, path): # A hideous, hideous kludge, but Tornado seems to have no more sensible # way to do this. @@ -15,9 +21,6 @@ class uApplication(libpry.AutoTree): del r.connection return klass(a, r) - def test_create(self): - assert app.PathodApp(staticdir=None) - def test_index(self): page = self.dummy_page("/") page.get() @@ -31,5 +34,6 @@ class uApplication(libpry.AutoTree): tests = [ - uApplication() + uApplication(), + uPages() ] diff --git a/test/test_utils.py b/test/test_utils.py index 7c6c7cb1..f8c7edb7 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -2,7 +2,13 @@ import libpry from libpathod import utils +class uparse_anchor_spec(libpry.AutoTree): + def test_simple(self): + assert utils.parse_anchor_spec("foo=200", {}) == ("foo", "200") + libpry.raises(utils.AnchorError, utils.parse_anchor_spec, "*=200", {}) + libpry.raises(utils.AnchorError, utils.parse_anchor_spec, "foo=bar", {}) tests = [ + uparse_anchor_spec() ] |
