diff --git a/pywb/warcserver/test/testutils.py b/pywb/warcserver/test/testutils.py index f4c73744..d5b5824a 100644 --- a/pywb/warcserver/test/testutils.py +++ b/pywb/warcserver/test/testutils.py @@ -5,7 +5,7 @@ import shutil import yaml import time -from fakeredis import FakeStrictRedis +from fakeredis import FakeStrictRedis, DATABASES from mock import patch from pywb.warcserver.basewarcserver import BaseWarcServer @@ -64,6 +64,10 @@ class FakeRedisTests(object): @classmethod def setup_class(cls, redis_url='redis://localhost:6379/2'): super(FakeRedisTests, cls).setup_class() + + PUBSUBS.clear() + DATABASES.clear() + cls.redismock = patch('redis.StrictRedis', FakeStrictRedisSharedPubSub) cls.redismock.start() diff --git a/tests/test_record_replay.py b/tests/test_record_replay.py index ca00b2ca..e5558fbb 100644 --- a/tests/test_record_replay.py +++ b/tests/test_record_replay.py @@ -63,15 +63,15 @@ class TestRecordReplay(CollsDirMixin, BaseConfigTest): assert '"C": "D"' in res.text def test_record_again_1(self): - res = self.testapp.get('/test/record/mp_/http://httpbin.org/get?C=D') - assert '"C": "D"' in res.text + res = self.testapp.get('/test/record/mp_/http://httpbin.org/get?C=D2') + 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=D', fmod_slash) - assert '"C": "D"' in res.text + res = self.get('/test/{0}http://httpbin.org/get?C=D2', fmod_slash) + assert '"C": "D2"' in res.text assert len(os.listdir(os.path.join(self.root_dir, '_test_colls', 'test', 'archive'))) == 1 @@ -104,12 +104,12 @@ class TestRecordReplay(CollsDirMixin, BaseConfigTest): assert cdxj_lines[0]['url'] == 'http://httpbin.org/get?A=B' assert cdxj_lines[1]['url'] == 'http://httpbin.org/get?A=B' assert cdxj_lines[2]['url'] == 'http://httpbin.org/get?C=D' - assert cdxj_lines[3]['url'] == 'http://httpbin.org/get?C=D' + assert cdxj_lines[3]['url'] == 'http://httpbin.org/get?C=D2' assert cdxj_lines[0]['urlkey'] == 'org,httpbin)/get?__pywb_method=head&a=b' assert cdxj_lines[1]['urlkey'] == 'org,httpbin)/get?a=b' assert cdxj_lines[2]['urlkey'] == 'org,httpbin)/get?c=d' - assert cdxj_lines[3]['urlkey'] == 'org,httpbin)/get?c=d' + assert cdxj_lines[3]['urlkey'] == 'org,httpbin)/get?c=d2' assert cdxj_lines[0]['source'] == to_path('test/indexes/autoindex.cdxj') assert cdxj_lines[1]['source'] == to_path('test/indexes/autoindex.cdxj') @@ -126,10 +126,10 @@ class TestRecordReplay(CollsDirMixin, BaseConfigTest): def test_timemap_all_coll(self): res = self.testapp.get('/all/timemap/link/http://httpbin.org/get?C=D') link_lines = res.text.rstrip().split('\n') - assert len(link_lines) == 5 + assert len(link_lines) == 4 assert to_path('collection="test2"') in link_lines[3] - assert to_path('collection="test"') in link_lines[4] + #assert to_path('collection="test"') in link_lines[4] # ============================================================================