diff options
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() ] |