diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/test_pathod.py | 6 | ||||
| -rw-r--r-- | test/test_test.py | 12 |
2 files changed, 15 insertions, 3 deletions
diff --git a/test/test_pathod.py b/test/test_pathod.py index 966ae12e..e00694cd 100644 --- a/test/test_pathod.py +++ b/test/test_pathod.py @@ -15,7 +15,11 @@ class _TestApplication: class TestPathod: def test_instantiation(self): - p = pathod.Pathod(("127.0.0.1", 0)) + p = pathod.Pathod( + ("127.0.0.1", 0), + anchors = [(".*", "200")] + ) + assert p.anchors def test_logging(self): p = pathod.Pathod(("127.0.0.1", 0)) diff --git a/test/test_test.py b/test/test_test.py index b9a9cfac..dcf980bc 100644 --- a/test/test_test.py +++ b/test/test_test.py @@ -38,7 +38,10 @@ class TestDaemonManual: class TestDaemon: @classmethod def setUpAll(self): - self.d = test.Daemon(staticdir=tutils.test_data.path("data")) + self.d = test.Daemon( + staticdir=tutils.test_data.path("data"), + anchors=[("/anchor/.*", "202")] + ) @classmethod def tearDownAll(self): @@ -47,6 +50,9 @@ class TestDaemon: def setUp(self): self.d.clear_log() + def getpath(self, path): + return requests.get("http://localhost:%s/%s"%(self.d.port, path)) + def get(self, spec): return requests.get("http://localhost:%s/p/%s"%(self.d.port, spec)) @@ -72,5 +78,7 @@ class TestDaemon: assert rsp.status_code == 200 assert rsp.content.strip() == "testfile" - + def test_anchor(self): + rsp = self.getpath("anchor/foo") + assert rsp.status_code == 202 |
