1
0
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:
Ed Summers 2023-09-22 10:57:05 -04:00
parent 5b72d96871
commit 0bdc96855a
No known key found for this signature in database
GPG Key ID: D012FF557AFFF80A
3 changed files with 19 additions and 19 deletions

View File

@ -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',
'&param.recorder.user=USER&param.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', '&param.recorder.user=USER2&param.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', '&param.recorder.user=USER2&param.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',
'&param.recorder.user=USER&param.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',
'&param.recorder.user=USER&param.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', '&param.recorder.user=USER&param.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', '&param.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', '&param.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', '&param.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', '&param.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', '&param.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)

View File

@ -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']

View File

@ -6,4 +6,4 @@ urllib3
flask
ujson
lxml
httpbin @ git+https://github.com/aaronhmiller/httpbin.git
httpbin