aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pathod/test.py8
-rw-r--r--test/pathod/test_app.py2
-rw-r--r--test/pathod/test_pathod.py7
3 files changed, 7 insertions, 10 deletions
diff --git a/pathod/test.py b/pathod/test.py
index 797b4970..0804951e 100644
--- a/pathod/test.py
+++ b/pathod/test.py
@@ -75,16 +75,13 @@ class Daemon:
"""
Return the log buffer as a list of dictionaries.
"""
- resp = requests.get("%s/api/log" % self.urlbase, verify=False)
- return resp.json()["log"]
+ return self.thread.server.get_log()
def clear_log(self):
"""
Clear the log.
"""
- self.logfp.truncate(0)
- resp = requests.get("%s/api/clear_log" % self.urlbase, verify=False)
- return resp.ok
+ return self.thread.server.clear_log()
def shutdown(self):
"""
@@ -101,6 +98,7 @@ class _PaThread(threading.Thread):
self.name = "PathodThread"
self.iface, self.q, self.ssl = iface, q, ssl
self.daemonargs = daemonargs
+ self.server = None
def run(self):
self.server = pathod.Pathod(
diff --git a/test/pathod/test_app.py b/test/pathod/test_app.py
index ac89c44c..7f691485 100644
--- a/test/pathod/test_app.py
+++ b/test/pathod/test_app.py
@@ -27,7 +27,7 @@ class TestApp(tutils.DaemonTests):
def test_log(self):
assert self.getpath("/log").status_code == 200
assert self.get("200:da").status_code == 200
- id = self.d.log()[0]["id"]
+ id = self.d.expect_log(1)[0]["id"]
assert self.getpath("/log").status_code == 200
assert self.getpath("/log/%s" % id).status_code == 200
assert self.getpath("/log/9999999").status_code == 404
diff --git a/test/pathod/test_pathod.py b/test/pathod/test_pathod.py
index 5773a3c9..9916984e 100644
--- a/test/pathod/test_pathod.py
+++ b/test/pathod/test_pathod.py
@@ -142,11 +142,10 @@ class CommonTests(tutils.DaemonTests):
assert tuple(self.d.info()["version"]) == version.IVERSION
def test_logs(self):
- assert self.d.clear_log()
- assert not self.d.last_log()
+ self.d.clear_log()
assert self.get("202:da")
- assert len(self.d.log()) == 1
- assert self.d.clear_log()
+ assert self.d.expect_log(1)
+ self.d.clear_log()
assert len(self.d.log()) == 0
def test_disconnect(self):