diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2012-06-07 11:23:23 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2012-06-07 11:23:23 +1200 |
commit | 14b2a69d2119d8b9d0260aa31190fc7869b45e05 (patch) | |
tree | c60d2ccfe7ca32a73b4c3847bff937ba89c1c001 /test | |
parent | b5a74a26ee6548b493cdece5a05f4fcba71c0012 (diff) | |
download | mitmproxy-14b2a69d2119d8b9d0260aa31190fc7869b45e05.tar.gz mitmproxy-14b2a69d2119d8b9d0260aa31190fc7869b45e05.tar.bz2 mitmproxy-14b2a69d2119d8b9d0260aa31190fc7869b45e05.zip |
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.
Diffstat (limited to 'test')
-rw-r--r-- | test/test_pathod.py | 8 | ||||
-rw-r--r-- | test/test_test.py | 21 |
2 files changed, 29 insertions, 0 deletions
diff --git a/test/test_pathod.py b/test/test_pathod.py index bb78e094..af02239e 100644 --- a/test/test_pathod.py +++ b/test/test_pathod.py @@ -57,7 +57,15 @@ class uPages(libpry.AutoTree): assert "".join(page._write_buffer) +class u_make_server(libpry.AutoTree): + def test_simple(self): + app = pathod.PathodApp() + assert pathod.make_server(app, 0, "127.0.0.1", None) + + tests = [ uApplication(), + #uPages(), + u_make_server() ] 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() +] |