mirror of
https://github.com/webrecorder/pywb.git
synced 2025-03-15 08:04:49 +01:00
httpbin adjustments
Use the latest httpbin from psf/httpbin and adjust some json responses since the formatting has changed slightly.
This commit is contained in:
parent
5b72d96871
commit
0bdc96855a
@ -150,7 +150,7 @@ class TestRecorder(LiveServerTests, HttpBinLiveTests, FakeRedisTests, TempDirTes
|
||||
|
||||
resp = self._test_warc_write(recorder_app, 'httpbin.org', '/get?foo=bar')
|
||||
assert b'HTTP/1.1 200 OK' in resp.body
|
||||
assert b'"foo": "bar"' in resp.body
|
||||
assert b'"foo":"bar"' in resp.body
|
||||
|
||||
self._test_all_warcs('/warcs/', 1)
|
||||
|
||||
@ -160,7 +160,7 @@ class TestRecorder(LiveServerTests, HttpBinLiveTests, FakeRedisTests, TempDirTes
|
||||
|
||||
resp = self._test_warc_write(recorder_app, 'httpbin.org', '/get?foo=bar')
|
||||
assert b'HTTP/1.1 200 OK' in resp.body
|
||||
assert b'"foo": "bar"' in resp.body
|
||||
assert b'"foo":"bar"' in resp.body
|
||||
|
||||
self._test_all_warcs('/warcs/', 2)
|
||||
|
||||
@ -262,7 +262,7 @@ class TestRecorder(LiveServerTests, HttpBinLiveTests, FakeRedisTests, TempDirTes
|
||||
|
||||
resp = self._test_warc_write(recorder_app, 'httpbin.org', '/get?foo=bar')
|
||||
assert b'HTTP/1.1 200 OK' in resp.body
|
||||
assert b'"foo": "bar"' in resp.body
|
||||
assert b'"foo":"bar"' in resp.body
|
||||
|
||||
self._test_all_warcs('/warcs/', 2)
|
||||
|
||||
@ -279,7 +279,7 @@ class TestRecorder(LiveServerTests, HttpBinLiveTests, FakeRedisTests, TempDirTes
|
||||
resp = self._test_warc_write(recorder_app, 'httpbin.org', '/user-agent',
|
||||
'¶m.recorder.user=USER¶m.recorder.coll=COLL')
|
||||
|
||||
assert '"user-agent": "{0}"'.format(UA) in resp.text
|
||||
assert '"user-agent":"{0}"'.format(UA) in resp.text
|
||||
#assert b'HTTP/1.1 200 OK' in resp.body
|
||||
#assert b'"foo": "bar"' in resp.body
|
||||
|
||||
@ -312,12 +312,12 @@ class TestRecorder(LiveServerTests, HttpBinLiveTests, FakeRedisTests, TempDirTes
|
||||
resp = self._test_warc_write(recorder_app, 'httpbin.org',
|
||||
'/get?foo=bar', '¶m.recorder.user=USER2¶m.recorder.coll=COLL2')
|
||||
assert b'HTTP/1.1 200 OK' in resp.body
|
||||
assert b'"foo": "bar"' in resp.body
|
||||
assert b'"foo":"bar"' in resp.body
|
||||
|
||||
resp = self._test_warc_write(recorder_app, 'httpbin.org',
|
||||
'/get?foo=bar', '¶m.recorder.user=USER2¶m.recorder.coll=COLL3')
|
||||
assert b'HTTP/1.1 200 OK' in resp.body
|
||||
assert b'"foo": "bar"' in resp.body
|
||||
assert b'"foo":"bar"' in resp.body
|
||||
|
||||
self._test_all_warcs('/warcs2', 2)
|
||||
|
||||
@ -334,7 +334,7 @@ class TestRecorder(LiveServerTests, HttpBinLiveTests, FakeRedisTests, TempDirTes
|
||||
resp = self._test_warc_write(recorder_app, 'httpbin.org', '/user-agent',
|
||||
'¶m.recorder.user=USER¶m.recorder.coll=COLL')
|
||||
|
||||
assert '"user-agent": "{0}"'.format(UA) in resp.text
|
||||
assert '"user-agent":"{0}"'.format(UA) in resp.text
|
||||
#assert b'HTTP/1.1 200 OK' in resp.body
|
||||
#assert b'"foo": "bar"' in resp.body
|
||||
|
||||
@ -387,7 +387,7 @@ class TestRecorder(LiveServerTests, HttpBinLiveTests, FakeRedisTests, TempDirTes
|
||||
resp = self._test_warc_write(recorder_app, 'httpbin.org', '/user-agent',
|
||||
'¶m.recorder.user=USER¶m.recorder.coll=COLL')
|
||||
|
||||
assert '"user-agent": "{0}"'.format(UA) in resp.text
|
||||
assert '"user-agent":"{0}"'.format(UA) in resp.text
|
||||
#assert b'HTTP/1.1 200 OK' in resp.body
|
||||
#assert b'"foo": "bar"' in resp.body
|
||||
self._test_all_warcs('/warcs/USER/COLL/', 2)
|
||||
@ -409,7 +409,7 @@ class TestRecorder(LiveServerTests, HttpBinLiveTests, FakeRedisTests, TempDirTes
|
||||
resp = self._test_warc_write(recorder_app, 'httpbin.org',
|
||||
'/get?foo=bar', '¶m.recorder.user=USER¶m.recorder.coll=COLL')
|
||||
assert b'HTTP/1.1 200 OK' in resp.body
|
||||
assert b'"foo": "bar"' in resp.body
|
||||
assert b'"foo":"bar"' in resp.body
|
||||
|
||||
self._test_all_warcs('/warcs/USER/COLL/', 3)
|
||||
|
||||
@ -432,7 +432,7 @@ class TestRecorder(LiveServerTests, HttpBinLiveTests, FakeRedisTests, TempDirTes
|
||||
|
||||
resp = self._test_warc_write(recorder_app, 'httpbin.org', '/get?foo=bar')
|
||||
assert b'HTTP/1.1 200 OK' in resp.body
|
||||
assert b'"foo": "bar"' in resp.body
|
||||
assert b'"foo":"bar"' in resp.body
|
||||
|
||||
assert os.path.isfile(path)
|
||||
assert len(writer.fh_cache) == 1
|
||||
@ -455,7 +455,7 @@ class TestRecorder(LiveServerTests, HttpBinLiveTests, FakeRedisTests, TempDirTes
|
||||
'/get?foo=bar', '¶m.recorder.coll=FOO')
|
||||
|
||||
assert b'HTTP/1.1 200 OK' in resp.body
|
||||
assert b'"foo": "bar"' in resp.body
|
||||
assert b'"foo":"bar"' in resp.body
|
||||
|
||||
|
||||
# Second Record
|
||||
@ -463,7 +463,7 @@ class TestRecorder(LiveServerTests, HttpBinLiveTests, FakeRedisTests, TempDirTes
|
||||
'/get?boo=far', '¶m.recorder.coll=FOO')
|
||||
|
||||
assert b'HTTP/1.1 200 OK' in resp.body
|
||||
assert b'"boo": "far"' in resp.body
|
||||
assert b'"boo":"far"' in resp.body
|
||||
|
||||
self._test_all_warcs('/warcs/FOO/', 1)
|
||||
|
||||
@ -523,14 +523,14 @@ class TestRecorder(LiveServerTests, HttpBinLiveTests, FakeRedisTests, TempDirTes
|
||||
'/get?foo=bar', '¶m.recorder.coll=GOO')
|
||||
|
||||
assert b'HTTP/1.1 200 OK' in resp.body
|
||||
assert b'"foo": "bar"' in resp.body
|
||||
assert b'"foo":"bar"' in resp.body
|
||||
|
||||
# Second Record
|
||||
resp = self._test_warc_write(recorder_app, 'httpbin.org',
|
||||
'/get?boo=far', '¶m.recorder.coll=GOO')
|
||||
|
||||
assert b'HTTP/1.1 200 OK' in resp.body
|
||||
assert b'"boo": "far"' in resp.body
|
||||
assert b'"boo":"far"' in resp.body
|
||||
|
||||
self._test_all_warcs('/warcs/GOO/', 1)
|
||||
|
||||
@ -542,7 +542,7 @@ class TestRecorder(LiveServerTests, HttpBinLiveTests, FakeRedisTests, TempDirTes
|
||||
'/get?goo=bar', '¶m.recorder.coll=GOO')
|
||||
|
||||
assert b'HTTP/1.1 200 OK' in resp.body
|
||||
assert b'"goo": "bar"' in resp.body
|
||||
assert b'"goo":"bar"' in resp.body
|
||||
|
||||
self._test_all_warcs('/warcs/GOO/', 2)
|
||||
|
||||
|
@ -162,7 +162,7 @@ class TestBaseWarcServer(HttpBinLiveTests, MementoOverrideTests, FakeRedisTests,
|
||||
assert resp.headers['Memento-Datetime'] != ''
|
||||
|
||||
assert b'HTTP/1.1 200 OK' in resp.body
|
||||
assert b'"foo": "bar"' in resp.body
|
||||
assert b'"foo":"bar"' in resp.body
|
||||
|
||||
assert 'ResErrors' not in resp.headers
|
||||
|
||||
@ -178,7 +178,7 @@ class TestBaseWarcServer(HttpBinLiveTests, MementoOverrideTests, FakeRedisTests,
|
||||
assert resp.headers['Memento-Datetime'] != ''
|
||||
|
||||
assert b'HTTP/1.1 200 OK' in resp.body
|
||||
assert b'"foo": "bar"' in resp.body
|
||||
assert b'"foo":"bar"' in resp.body
|
||||
|
||||
assert 'ResErrors' not in resp.headers
|
||||
|
||||
@ -288,7 +288,7 @@ Host: httpbin.org
|
||||
assert resp.headers['Memento-Datetime'] != ''
|
||||
|
||||
assert b'HTTP/1.1 200 OK' in resp.body
|
||||
assert b'"foo": "bar"' in resp.body
|
||||
assert b'"foo":"bar"' in resp.body
|
||||
|
||||
#assert json.loads(resp.headers['ResErrors']) == {"rhiz": "NotFoundException('https://webenact.rhizome.org/vvork/http://httpbin.org/get?foo=bar',)"}
|
||||
assert "NotFoundException('https://webenact.rhizome.org/vvork/" in json.loads(resp.headers['ResErrors'])['rhiz']
|
||||
|
@ -6,4 +6,4 @@ urllib3
|
||||
flask
|
||||
ujson
|
||||
lxml
|
||||
httpbin @ git+https://github.com/aaronhmiller/httpbin.git
|
||||
httpbin
|
||||
|
Loading…
x
Reference in New Issue
Block a user