From 14b2a69d2119d8b9d0260aa31190fc7869b45e05 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Thu, 7 Jun 2012 11:23:23 +1200 Subject: Start building a Pathod unit testing truss. - Add test.py, which will house the testing API. - Extend API with a shutdown method, used to terminate the test daemon. - Refactor to allow clean shutdown. --- test/test_test.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 test/test_test.py (limited to 'test/test_test.py') diff --git a/test/test_test.py b/test/test_test.py new file mode 100644 index 00000000..6e80dd77 --- /dev/null +++ b/test/test_test.py @@ -0,0 +1,21 @@ +import time +import libpry +import requests +from libpathod import test + + +class uDaemon(libpry.AutoTree): + def test_startstop(self): + d = test.Daemon() + rsp = requests.get("http://localhost:%s/p/202"%d.port) + assert rsp.ok + assert rsp.status_code == 202 + d.shutdown() + rsp = requests.get("http://localhost:%s/p/202"%d.port) + assert not rsp.ok + + + +tests = [ + uDaemon() +] -- cgit v1.2.3