From e52a37ffa962f662cfcab8056c8af5b0ac9f416b Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Mon, 30 Jul 2012 17:29:36 +1200 Subject: Cleanup of libpathod.test, test example for front page. --- libpathod/templates/docs_lang.html | 11 +++++------ libpathod/templates/examples_test.html | 18 ++++++++++++++++++ libpathod/templates/index.html | 2 ++ libpathod/templates/response_previewform.html | 4 ++-- 4 files changed, 27 insertions(+), 8 deletions(-) create mode 100644 libpathod/templates/examples_test.html (limited to 'libpathod/templates') diff --git a/libpathod/templates/docs_lang.html b/libpathod/templates/docs_lang.html index 46f5f401..ebed7388 100644 --- a/libpathod/templates/docs_lang.html +++ b/libpathod/templates/docs_lang.html @@ -31,8 +31,8 @@ bVALUE - Set the body. When the body is set, pathod will - automatically set the appropriate Content-Length header. + Set the body. The appropriate Content-Length header is + added automatically unless the "r" flag is set. @@ -104,8 +104,8 @@ bVALUE - Set the body. When the body is set, pathod will - automatically set the appropriate Content-Length header. + Set the body. The appropriate Content-Length header is + added automatically unless the "r" flag is set. @@ -143,8 +143,7 @@ r Set the "raw" flag on this response. Pathod will not - calculate a Content-Length header if a body is set, or add - a Date header to the response. + calculate a Content-Length header if a body is set. diff --git a/libpathod/templates/examples_test.html b/libpathod/templates/examples_test.html new file mode 100644 index 00000000..57d39534 --- /dev/null +++ b/libpathod/templates/examples_test.html @@ -0,0 +1,18 @@ +
import requests
+from libpathod import test
+
+class Test:
+    def setUp(self):
+        self.daemon = test.Daemon()
+
+    def tearDown(self):
+        self.daemon.shutdown()
+
+    def test_simple(self):
+        path = self.daemon.p("200:b@100")
+        r = requests.get(path)
+        assert r.status_code == 200
+        assert len(r.content) == 100
+        log = self.daemon.last_log()
+        assert log["request"]["method"] == "GET"
+
diff --git a/libpathod/templates/index.html b/libpathod/templates/index.html index 42c8c413..c31d4414 100644 --- a/libpathod/templates/index.html +++ b/libpathod/templates/index.html @@ -72,6 +72,8 @@

Using pathod and pathoc in your unit tests.

+ {% include "examples_test.html" %} + diff --git a/libpathod/templates/response_previewform.html b/libpathod/templates/response_previewform.html index 19e28d08..6c2efded 100644 --- a/libpathod/templates/response_previewform.html +++ b/libpathod/templates/response_previewform.html @@ -1,6 +1,6 @@
{% if not nocraft %} - go to + go {% endif %}
-- cgit v1.2.3