aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/test_pathod.py18
-rw-r--r--test/tutils.py13
2 files changed, 23 insertions, 8 deletions
diff --git a/test/test_pathod.py b/test/test_pathod.py
index 0adba8e6..58477620 100644
--- a/test/test_pathod.py
+++ b/test/test_pathod.py
@@ -1,5 +1,6 @@
from libpathod import pathod, version
from netlib import tcp, http
+import requests
import tutils
class TestPathod:
@@ -26,6 +27,17 @@ class TestPathod:
assert len(p.get_log()) <= p.LOGBUF
+class TestNoWeb(tutils.DaemonTests):
+ noweb = True
+ def setUp(self):
+ # Over ride log clearing
+ pass
+
+ def test_noweb(self):
+ assert self.get("200").status_code == 200
+ assert self.getpath("/").status_code == 800
+
+
class CommonTests(tutils.DaemonTests):
def test_sizelimit(self):
r = self.get("200:b@1g")
@@ -67,7 +79,7 @@ class CommonTests(tutils.DaemonTests):
def test_invalid_first_line(self):
c = tcp.TCPClient("localhost", self.d.port)
c.connect()
- if self.SSL:
+ if self.ssl:
c.convert_to_ssl()
c.wfile.write("foo\n\n\n")
c.wfile.flush()
@@ -92,11 +104,11 @@ class CommonTests(tutils.DaemonTests):
class TestDaemon(CommonTests):
- SSL = False
+ ssl = False
class TestDaemonSSL(CommonTests):
- SSL = True
+ ssl = True
def test_ssl_conn_failure(self):
c = tcp.TCPClient("localhost", self.d.port)
c.rbufsize = 0
diff --git a/test/tutils.py b/test/tutils.py
index 3b430825..b1e277e7 100644
--- a/test/tutils.py
+++ b/test/tutils.py
@@ -4,13 +4,16 @@ from libpathod import utils, test, pathoc
import requests
class DaemonTests:
+ noweb = False
+ ssl = False
@classmethod
def setUpAll(self):
self.d = test.Daemon(
staticdir=test_data.path("data"),
anchors=[("/anchor/.*", "202")],
- ssl = self.SSL,
- sizelimit=1*1024*1024
+ ssl = self.ssl,
+ sizelimit=1*1024*1024,
+ noweb = self.noweb
)
@classmethod
@@ -21,19 +24,19 @@ class DaemonTests:
self.d.clear_log()
def getpath(self, path, params=None):
- scheme = "https" if self.SSL else "http"
+ scheme = "https" if self.ssl else "http"
return requests.get(
"%s://localhost:%s/%s"%(scheme, self.d.port, path), verify=False, params=params
)
def get(self, spec):
- scheme = "https" if self.SSL else "http"
+ 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, timeout=None):
c = pathoc.Pathoc("localhost", self.d.port)
c.connect()
- if self.SSL:
+ if self.ssl:
c.convert_to_ssl()
if timeout:
c.settimeout(timeout)