From 5577d85ce6835fddce6e0eaf98b241e42e959a25 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Sat, 21 Jul 2012 14:14:31 +1200 Subject: [PATCH] Use injection to test a corner case in pathod daemon. --- test/test_pathod.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/test/test_pathod.py b/test/test_pathod.py index 9f01b25cc..a23b7c711 100644 --- a/test/test_pathod.py +++ b/test/test_pathod.py @@ -1,5 +1,5 @@ import requests -from libpathod import pathod, test, version +from libpathod import pathod, test, version, pathoc from netlib import tcp import tutils @@ -64,6 +64,17 @@ class _DaemonTests: scheme = "https" if self.SSL else "http" return requests.get("%s://localhost:%s/p/%s"%(scheme, self.d.port, spec), verify=False) + def pathoc(self, spec): + c = pathoc.Pathoc("localhost", self.d.port) + c.connect() + if self.SSL: + c.convert_to_ssl() + return c.request(spec) + + def test_preline(self): + v = self.pathoc(r"get:'/p/200':i0,'\r\n'") + assert v[1] == 200 + def test_info(self): assert tuple(self.d.info()["version"]) == version.IVERSION