mitmproxy/test/test_test.py
Aldo Cortesi 14b2a69d21 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.
2012-06-07 11:23:23 +12:00

22 lines
421 B
Python

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