aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/test_pathod.py6
-rw-r--r--test/tutils.py10
2 files changed, 11 insertions, 5 deletions
diff --git a/test/test_pathod.py b/test/test_pathod.py
index 0936fce3..0463fc55 100644
--- a/test/test_pathod.py
+++ b/test/test_pathod.py
@@ -150,6 +150,12 @@ class CommonTests(tutils.DaemonTests):
class TestDaemon(CommonTests):
ssl = False
+ def test_connect(self):
+ v = self.pathoc(r"get:'http://foo.com/p/202':da", connect_to=("localhost", self.d.port), ssl=True)
+ assert v[1] == 202
+
+ def test_connect_err(self):
+ tutils.raises(http.HttpError, self.pathoc, r"get:'http://foo.com/p/202':da", connect_to=("localhost", self.d.port))
class TestDaemonSSL(CommonTests):
diff --git a/test/tutils.py b/test/tutils.py
index 0a5455a3..580174d9 100644
--- a/test/tutils.py
+++ b/test/tutils.py
@@ -44,11 +44,11 @@ class DaemonTests:
def get(self, spec):
return requests.get(self.d.p(spec), verify=False)
- def pathoc(self, spec, timeout=None):
- c = pathoc.Pathoc("localhost", self.d.port)
- c.connect()
- if self.ssl:
- c.convert_to_ssl()
+ def pathoc(self, spec, timeout=None, connect_to=None, ssl=None):
+ if ssl is None:
+ ssl = self.ssl
+ c = pathoc.Pathoc("localhost", self.d.port, ssl=ssl)
+ c.connect(connect_to)
if timeout:
c.settimeout(timeout)
return c.request(spec)