From 76f0c3ea783dbb46540a3b77b13f7700e9639ea4 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Fri, 20 Jul 2012 11:40:37 +1200 Subject: Handle invalid first line errors, add an error log buffer type. --- test/test_pathod.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'test/test_pathod.py') diff --git a/test/test_pathod.py b/test/test_pathod.py index bf15bc23..902074b7 100644 --- a/test/test_pathod.py +++ b/test/test_pathod.py @@ -1,5 +1,6 @@ import requests from libpathod import pathod, test, version +from netlib import tcp import tutils class _TestApplication: @@ -60,12 +61,22 @@ class TestDaemon: def get(self, spec): return requests.get("http://localhost:%s/p/%s"%(self.d.port, spec)) + def test_invalid_first_line(self): + c = tcp.TCPClient("localhost", self.d.port) + c.connect() + c.wfile.write("foo\n\n\n") + c.wfile.flush() + l = self.d.log()[0] + assert l["type"] == "error" + assert "foo" in l["msg"] + def test_info(self): assert tuple(self.d.info()["version"]) == version.IVERSION def test_logs(self): + l = len(self.d.log()) rsp = self.get("202") - assert len(self.d.log()) == 1 + assert len(self.d.log()) == l+1 assert self.d.clear_log() assert len(self.d.log()) == 0 -- cgit v1.2.3