From fde65270afb3855057a86b40c5996c86f58fe97b Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Mon, 30 Jul 2012 20:58:59 +1200 Subject: Testing examples and docs. --- libpathod/templates/examples_setup.html | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 libpathod/templates/examples_setup.html (limited to 'libpathod/templates/examples_setup.html') diff --git a/libpathod/templates/examples_setup.html b/libpathod/templates/examples_setup.html new file mode 100644 index 00000000..bde45840 --- /dev/null +++ b/libpathod/templates/examples_setup.html @@ -0,0 +1,29 @@ +
import requests
+from libpathod import test
+
+class Test:
+    """
+        Testing the requests module with 
+        a pathod instance started for 
+        each test.
+    """
+    def setUp(self):
+        self.d = test.Daemon()
+
+    def tearDown(self):
+        self.d.shutdown()
+
+    def test_simple(self):
+        # Get a URL for a pathod spec
+        url = self.d.p("200:b@100")
+        # ... and request it
+        r = requests.put(url)
+
+        # Check the returned data
+        assert r.status_code == 200
+        assert len(r.content) == 100
+
+        # Check pathod's internal log
+        log = self.d.last_log()["request"]
+        assert log["method"] == "PUT"
+
-- cgit v1.2.3