Esempio n. 1
0
 def setup_class(cls):
     rec_custom = {
         'collections': {
             'fallback': {
                 'sequence': [{
                     'index_paths':
                     os.path.join(TEST_CDX_PATH, 'example.cdxj'),
                     'archive_paths':
                     TEST_WARC_PATH,
                     'name':
                     'example'
                 }, {
                     'index': '$live',
                     'name': 'live'
                 }]
             }
         },
         'recorder': {
             'source_coll': 'fallback',
             'source_filter': 'live',
         }
     }
     super(TestRecordFilter, cls).setup_class('config_test_record.yaml',
                                              custom_config=rec_custom)
     manager(['init', 'test-new'])
Esempio n. 2
0
    def test_init_coll(self):
        manager(['init', 'test'])
        assert os.path.isdir(
            os.path.join(self.root_dir, '_test_colls', 'test', 'archive'))

        manager(['init', 'test2'])
        assert os.path.isdir(
            os.path.join(self.root_dir, '_test_colls', 'test2', 'archive'))
Esempio n. 3
0
 def setup_class(cls):
     super(TestProxyAutoFetchWorkerEndPoints,
           cls).setup_class(coll='test2',
                            config_file='config_test_record.yaml',
                            proxy_opts={'enable_wombat': True},
                            config_opts={'enable_auto_fetch': True},
                            recording=True)
     manager(['init', 'test2'])
Esempio n. 4
0
    def test_proxy_replay_recorded(self, scheme):
        manager(['reindex', 'test'])

        self.app.proxy_prefix = '/test/bn_/'

        res = requests.get('{0}://httpbin.org/'.format(scheme),
                           proxies=self.proxies,
                           verify=self.root_ca_file)

        assert 'is_live = false' in res.text
        assert 'httpbin(1)' in res.text
Esempio n. 5
0
    def test_init_and_rec(self):
        manager(['init', 'test-new'])
        dir_name = os.path.join(self.root_dir, '_test_colls', 'test-new', 'archive')
        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

        names = os.listdir(dir_name)
        assert len(names) == 1
        assert names[0].startswith('pywb-rec-test-')
        assert names[0].endswith('.warcgz')
Esempio n. 6
0
    def test_init_and_rec(self):
        manager(['init', 'test-new'])
        dir_name = os.path.join(self.root_dir, '_test_colls', 'test-new', 'archive')
        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

        names = os.listdir(dir_name)
        assert len(names) == 1
        assert names[0].startswith('pywb-rec-test-')
        assert names[0].endswith('.warcgz')

        TestRecordCustomConfig.warc_name = os.path.join(dir_name, names[0])
Esempio n. 7
0
    def setup_class(cls):
        super(TestZipnumAutoDir, cls).setup_class('config_test.yaml')

        manager(['init', 'testzip'])

        cls.archive_dir = os.path.join(cls.root_dir, '_test_colls', 'testzip', 'archive')
        cls.index_dir = os.path.join(cls.root_dir, '_test_colls', 'testzip', 'indexes')

        zip_cdx = os.path.join(get_test_dir(), 'zipcdx')

        shutil.copy(os.path.join(zip_cdx, 'zipnum-sample.idx'), cls.index_dir)
        shutil.copy(os.path.join(zip_cdx, 'zipnum-sample.cdx.gz'), cls.index_dir)
        shutil.copy(os.path.join(zip_cdx, 'zipnum-sample.loc'), cls.index_dir)

        shutil.copy(os.path.join(get_test_dir(), 'warcs', 'iana.warc.gz'), cls.archive_dir)
Esempio n. 8
0
    def setup_class(cls):
        super(TestZipnumAutoDir, cls).setup_class('config_test.yaml')

        manager(['init', 'testzip'])

        cls.archive_dir = os.path.join(cls.root_dir, '_test_colls', 'testzip', 'archive')
        cls.index_dir = os.path.join(cls.root_dir, '_test_colls', 'testzip', 'indexes')

        zip_cdx = os.path.join(get_test_dir(), 'zipcdx')

        shutil.copy(os.path.join(zip_cdx, 'zipnum-sample.idx'), cls.index_dir)
        shutil.copy(os.path.join(zip_cdx, 'zipnum-sample.cdx.gz'), cls.index_dir)
        shutil.copy(os.path.join(zip_cdx, 'zipnum-sample.loc'), cls.index_dir)

        shutil.copy(os.path.join(get_test_dir(), 'warcs', 'iana.warc.gz'), cls.archive_dir)
Esempio n. 9
0
 def setup_class(cls):
     rec_custom = {'collections': {'fallback': {'sequence': [
                     {
                         'index_paths': os.path.join(TEST_CDX_PATH, 'example.cdxj'),
                         'archive_paths': TEST_WARC_PATH,
                         'name': 'example'
                     },{
                         'index':'$live',
                         'name': 'live'
                     }]}},
                     'recorder': {'source_coll': 'fallback',
                                  'source_filter': 'live',
                                  }
                  }
     super(TestRecordFilter, cls).setup_class('config_test_record.yaml', custom_config=rec_custom)
     manager(['init', 'test-new'])
Esempio n. 10
0
 def setup_class(cls, coll='pywb', config_file='config_test.yaml'):
     super(TestRecordingProxy, cls).setup_class('test', 'config_test_record.yaml', recording=True)
     manager(['init', 'test'])
Esempio n. 11
0
    def test_init_coll(self):
        manager(['init', 'test'])
        assert os.path.isdir(os.path.join(self.root_dir, '_test_colls', 'test', 'archive'))

        manager(['init', 'test2'])
        assert os.path.isdir(os.path.join(self.root_dir, '_test_colls', 'test2', 'archive'))