mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 16:17:49 +00:00
2f670bac99
We currently test with unparallelized builds, because there are apparently some race conditions in the test suite, which I can't trigger locally but happen on travis. Squashed commit of the following: commit 7dceb6dd3a1bdbc39688258bc4dff6eee685a33b Author: Maximilian Hils <git@maximilianhils.com> Date: Mon Sep 21 23:00:24 2015 +0200 disable parallelized tests commit fc0c3f12ee9259162e83026851362925d93b69f2 Author: Maximilian Hils <git@maximilianhils.com> Date: Mon Sep 21 22:49:19 2015 +0200 fix tests commit baba3ca5ef49bdbd7aad14f1bf0626738fa3d21c Author: Maximilian Hils <git@maximilianhils.com> Date: Mon Sep 21 22:28:20 2015 +0200 fix tests, use py.test
24 lines
575 B
Python
24 lines
575 B
Python
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"
|