diff --git a/pywb/recorder/test/test_recorder.py b/pywb/recorder/test/test_recorder.py index 60f337b0..80b329d9 100644 --- a/pywb/recorder/test/test_recorder.py +++ b/pywb/recorder/test/test_recorder.py @@ -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) @@ -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) diff --git a/tests/test_live_rewriter.py b/tests/test_live_rewriter.py index 1dd44b47..25891e50 100644 --- a/tests/test_live_rewriter.py +++ b/tests/test_live_rewriter.py @@ -36,7 +36,7 @@ def header_test_server(environ, start_response): # ============================================================================ def cookie_test_server(environ, start_response): - body = 'cookie value:' + environ.get('HTTP_COOKIE', '') + body = 'cookie value: ' + environ.get('HTTP_COOKIE', '') body = body.encode('utf-8') headers = [('Content-Length', str(len(body))), ('Content-Type', 'text/plain')] @@ -76,14 +76,14 @@ class TestLiveRewriter(HttpBinLiveTests, BaseConfigTest): resp = self.post('/live/{0}httpbin.org/post', fmod_sl, {'foo': 'bar', 'test': 'abc'}) assert resp.status_int == 200 resp.charset = 'utf-8' - assert '"foo":"bar"' in resp.text - assert '"test":"abc"' in resp.text + assert '"foo" :"bar"' in resp.text + assert '"test" :"abc"' in resp.text assert resp.status_int == 200 def test_live_anchor_encode(self, fmod_sl): resp = self.get('/live/{0}httpbin.org/get?val=abc%23%23xyz', fmod_sl) assert 'get?val=abc%23%23xyz"' in resp.text - assert '"val":"abc##xyz"' in resp.text + assert '"val" :"abc##xyz"' in resp.text #assert '"http://httpbin.org/anything/abc##xyz"' in resp.text assert resp.status_int == 200 @@ -128,18 +128,18 @@ class TestLiveRewriter(HttpBinLiveTests, BaseConfigTest): headers={'Host': 'example.com'}) assert resp.headers['Set-Cookie'] == 'testcookie=cookie-val; Path=/live/{0}http://localhost:{1}/'.format(fmod_sl, self.cookie_test_serv.port) - assert resp.text == 'cookie value:' + assert resp.text == 'cookie value: ' resp = self.get('/live/{0}http://localhost:%s/' % self.cookie_test_serv.port, fmod_sl, headers={'Host': 'example.com'}) - assert resp.text == 'cookie value:testcookie=cookie-val' + assert resp.text == 'cookie value: testcookie=cookie-val' resp = self.get('/live/{0}http://localhost:%s/' % self.cookie_test_serv.port, fmod_sl, headers={'Host': 'sub.example.com'}) assert 'Set-Cookie' not in resp.headers - assert resp.text == 'cookie value:testcookie=cookie-val' + assert resp.text == 'cookie value: testcookie=cookie-val' def test_fetch_page_with_html_title(self, fmod_sl): resp = self.get('/live/{0}http://localhost:%s/html-title' % self.header_test_serv.port, fmod_sl, @@ -181,7 +181,7 @@ class TestLiveRewriter(HttpBinLiveTests, BaseConfigTest): def test_deflate(self, fmod_sl): resp = self.get('/live/{0}http://httpbin.org/deflate', fmod_sl) - assert b'"deflated":true' in resp.body + assert b'"deflated" :true' in resp.body def test_live_origin_and_referrer(self, fmod_sl): headers = {'Referer': 'http://localhost:80/live/{0}http://example.com/test'.format(fmod_sl), diff --git a/tests/test_record_dedup.py b/tests/test_record_dedup.py index 4ed57a51..9b01e9e3 100644 --- a/tests/test_record_dedup.py +++ b/tests/test_record_dedup.py @@ -26,12 +26,12 @@ class TestRecordDedup(HttpBinLiveTests, CollsDirMixin, BaseConfigTest, FakeRedis def test_record_1(self): res = self.testapp.get('/test-dedup/record/mp_/http://httpbin.org/get?A=B', headers={"Referer": "http://httpbin.org/"}) - assert '"A":"B"' in res.text + assert '"A": "B"' in res.text time.sleep(1.2) res = self.testapp.get('/test-dedup/record/mp_/http://httpbin.org/get?A=B', headers={"Referer": "http://httpbin.org/"}) - assert '"A":"B"' in res.text + assert '"A": "B"' in res.text def test_single_redis_entry(self): res = self.redis.zrange("pywb:test-dedup:cdxj", 0, -1) diff --git a/tests/test_record_replay.py b/tests/test_record_replay.py index 8cd89149..c0f37392 100644 --- a/tests/test_record_replay.py +++ b/tests/test_record_replay.py @@ -35,7 +35,7 @@ class TestRecordReplay(HttpBinLiveTests, CollsDirMixin, BaseConfigTest): def test_record_1(self): res = self.testapp.get('/test/record/mp_/http://httpbin.org/get?A=B') - assert '"A":"B"' in res.text + assert '"A": "B"' in res.text def test_record_head(self): res = self.testapp.head('/test/record/mp_/http://httpbin.org/get?A=B') @@ -47,7 +47,7 @@ class TestRecordReplay(HttpBinLiveTests, CollsDirMixin, BaseConfigTest): fmod_slash = fmod + '/' if fmod else '' res = self.get('/test/{0}http://httpbin.org/get?A=B', fmod_slash) - assert '"A":"B"' in res.text + assert '"A": "B"' in res.text def test_replay_head(self, fmod): fmod_slash = fmod + '/' if fmod else '' @@ -58,25 +58,25 @@ class TestRecordReplay(HttpBinLiveTests, CollsDirMixin, BaseConfigTest): def test_record_2(self): res = self.testapp.get('/test2/record/mp_/http://httpbin.org/get?C=D') - assert '"C":"D"' in res.text + assert '"C": "D"' in res.text def test_replay_2(self, fmod): self.ensure_empty() fmod_slash = fmod + '/' if fmod else '' res = self.get('/test2/{0}http://httpbin.org/get?C=D', fmod_slash) - assert '"C":"D"' in res.text + assert '"C": "D"' in res.text def test_record_again_1(self): res = self.testapp.get('/test/record/mp_/http://httpbin.org/get?C=D2') - assert '"C":"D2"' in res.text + assert '"C": "D2"' in res.text def test_replay_again_1(self, fmod): self.ensure_empty() fmod_slash = fmod + '/' if fmod else '' res = self.get('/test/{0}http://httpbin.org/get?C=D2', fmod_slash) - assert '"C":"D2"' in res.text + assert '"C": "D2"' in res.text assert len(os.listdir(os.path.join(self.root_dir, '_test_colls', 'test', 'archive'))) == 1 @@ -94,10 +94,10 @@ class TestRecordReplay(HttpBinLiveTests, CollsDirMixin, BaseConfigTest): fmod_slash = fmod + '/' if fmod else '' res = self.get('/all/{0}http://httpbin.org/get?C=D', fmod_slash) - assert '"C":"D"' in res.text + assert '"C": "D"' in res.text res = self.get('/all/mp_/http://httpbin.org/get?A=B', fmod_slash) - assert '"A":"B"' in res.text + assert '"A": "B"' in res.text def test_cdx_all_coll(self): res = self.testapp.get('/all/cdx?url=http://httpbin.org/get*&output=json') @@ -163,7 +163,7 @@ class TestRecordCustomConfig(HttpBinLiveTests, CollsDirMixin, BaseConfigTest): assert os.path.isdir(dir_name) res = self.testapp.get('/test-new/record/mp_/http://httpbin.org/get?A=B') - assert '"A":"B"' in res.text + assert '"A": "B"' in res.text names = os.listdir(dir_name) assert len(names) == 1 @@ -176,7 +176,7 @@ class TestRecordCustomConfig(HttpBinLiveTests, CollsDirMixin, BaseConfigTest): def test_no_brotli(self): res = self.testapp.get('/test-new/record/mp_/http://httpbin.org/get?C=D', headers={'Accept-Encoding': 'gzip, deflate, br'}) - assert '"C":"D"' in res.text + assert '"C": "D"' in res.text with open(self.warc_name, 'rb') as fh: for record in ArchiveIterator(fh):