diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2012-11-02 14:22:54 +1300 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2012-11-02 14:22:54 +1300 |
commit | 791252ac5e26c818397d3b2928300672175d8ce8 (patch) | |
tree | dd4c2b8b8c291eef5ed2ed14aa32b66f04523a75 /.sources | |
parent | 3ca3e7c48551e56da61629cd492a16add87f12a0 (diff) | |
download | mitmproxy-791252ac5e26c818397d3b2928300672175d8ce8.tar.gz mitmproxy-791252ac5e26c818397d3b2928300672175d8ce8.tar.bz2 mitmproxy-791252ac5e26c818397d3b2928300672175d8ce8.zip |
Examples and documentation.
Diffstat (limited to '.sources')
-rw-r--r-- | .sources/examples_context.py | 22 | ||||
-rw-r--r-- | .sources/examples_setup.py | 28 | ||||
-rw-r--r-- | .sources/examples_setupall.py | 37 | ||||
-rwxr-xr-x | .sources/make | 7 |
4 files changed, 4 insertions, 90 deletions
diff --git a/.sources/examples_context.py b/.sources/examples_context.py deleted file mode 100644 index f3da83cb..00000000 --- a/.sources/examples_context.py +++ /dev/null @@ -1,22 +0,0 @@ -import requests -from libpathod import test - -def test_simple(): - """ - Testing the requests module with - a pathod context manager. - """ - # Start pathod in a separate thread - with test.Daemon() as d: - # Get a URL for a pathod spec - url = 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 = d.last_log()["request"] - assert log["method"] == "PUT" diff --git a/.sources/examples_setup.py b/.sources/examples_setup.py deleted file mode 100644 index 5366c9ef..00000000 --- a/.sources/examples_setup.py +++ /dev/null @@ -1,28 +0,0 @@ -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" diff --git a/.sources/examples_setupall.py b/.sources/examples_setupall.py deleted file mode 100644 index c8948971..00000000 --- a/.sources/examples_setupall.py +++ /dev/null @@ -1,37 +0,0 @@ -import requests -from libpathod import test - -class Test: - """ - Testing the requests module with - a single pathod instance started - for the test suite. - """ - @classmethod - def setUpAll(cls): - cls.d = test.Daemon() - - @classmethod - def tearDownAll(cls): - cls.d.shutdown() - - def setUp(self): - # Clear the pathod logs between tests - self.d.clear_log() - - 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" - - def test_two(self): - assert not self.d.log() diff --git a/.sources/make b/.sources/make index e0e9d2cc..1c8b1d69 100755 --- a/.sources/make +++ b/.sources/make @@ -1,4 +1,5 @@ #!/bin/sh -pygmentize -f html ./examples_context.py > ../libpathod/templates/examples_context.html -pygmentize -f html ./examples_setup.py > ../libpathod/templates/examples_setup.html -pygmentize -f html ./examples_setupall.py > ../libpathod/templates/examples_setupall.html +pygmentize -f html ../examples/test_context.py > ../libpathod/templates/examples_context.html +pygmentize -f html ../examples/test_setup.py > ../libpathod/templates/examples_setup.html +pygmentize -f html ../examples/test_setupall.py > ../libpathod/templates/examples_setupall.html +pygmentize -f html ../examples/libpathod_pathoc.py > ../libpathod/templates/libpathod_pathoc.html |