Esempio n. 1
0
def init_wayback(working_dir):
    res = Path(__file__).parent.absolute() / "res"
    work_dir = Path(working_dir).absolute()
    templates_src = res / "templates"
    templates_dst = work_dir / "templates"
    static_src = res / "static"
    static_dst = work_dir / "static"

    move(templates_src, templates_dst)
    move(static_src, static_dst)

    with cd(working_dir):
        wayback()
Esempio n. 2
0
 def test_proxy_cli(self):
     res = wayback(['--proxy', 'test'])
     exp = {'ca_file_cache': os.path.join('proxy-certs', 'pywb-ca.pem'),
            'ca_name': 'pywb HTTPS Proxy CA',
            'coll': 'test',
            'recording': False}
     assert res.extra_config['proxy'] == exp
Esempio n. 3
0
 def test_live_all_cli(self):
     res = wayback(['--all-coll', 'all', '--live'])
     assert res.extra_config['collections'] == {
         'live': {
             'index': '$live'
         },
         'all': '$all'
     }
Esempio n. 4
0
 def test_proxy_cli(self):
     res = wayback(['--proxy', 'test'])
     exp = {'ca_file_cache': os.path.join('proxy-certs', 'pywb-ca.pem'),
            'ca_name': 'pywb HTTPS Proxy CA',
            'coll': 'test',
            'recording': False,
            'enable_wombat': False,
            'default_timestamp': None
           }
     assert res.extra_config['proxy'] == exp
Esempio n. 5
0
    def test_run_cli(self):
        """ test new wayback cli interface
        test autoindex error before collections inited
        """
        from pywb.apps.cli import wayback
        wayback([])

        # Nothing to auto-index.. yet
        with raises(SystemExit):
            wayback(['-a'])

        colls = os.path.join(self.root_dir, 'collections')
        os.mkdir(colls)

        pywb.manager.autoindex.keep_running = False
        wayback(['-a'])
Esempio n. 6
0
    def test_run_cli(self):
        """ test new wayback cli interface
        test autoindex error before collections inited
        """
        from pywb.apps.cli import wayback

        wayback(['-p', '0'])

        # Nothing to auto-index.. yet
        with raises(SystemExit):
            wayback(['-a', '-p', '0'])

        colls = os.path.join(self.root_dir, COLLECTIONS)
        os.mkdir(colls)

        wayback(['-a', '-p', '0', '--auto-interval', '0'])
Esempio n. 7
0
    def test_run_cli(self):
        """ test new wayback cli interface
        test autoindex error before collections inited
        """
        from pywb.apps.cli import wayback
        wayback([])

        # Nothing to auto-index.. yet
        with raises(SystemExit):
            wayback(['-a'])

        colls = os.path.join(self.root_dir, 'collections')
        os.mkdir(colls)

        pywb.manager.autoindex.keep_running = False
        wayback(['-a'])
Esempio n. 8
0
    def test_run_cli(self):
        """ test new wayback cli interface
        test autoindex error before collections inited
        """
        from pywb.apps.cli import wayback

        wayback(['-p', '0'])

        # Nothing to auto-index.. yet
        with raises(SystemExit):
            wayback(['-a', '-p', '0'])

        colls = os.path.join(self.root_dir, COLLECTIONS)
        os.mkdir(colls)

        wayback(['-a', '-p', '0', '--auto-interval', '0'])
Esempio n. 9
0
 def test_proxy_cli_ts(self):
     res = wayback(['--proxy', 'test', '--proxy-default-timestamp', '20140103000102'])
     assert res.application.proxy_default_timestamp == '20140103000102'
Esempio n. 10
0
 def test_live_all_cli(self):
     res = wayback(['--all-coll', 'all', '--live'])
     assert res.extra_config['collections'] == {'live': {'index': '$live'},
                                                'all': '$all'}
Esempio n. 11
0
 def test_auto_fetch_cli(self):
     res = wayback(['--enable-auto-fetch'])
     assert res.extra_config['enable_auto_fetch'] == True
Esempio n. 12
0
 def test_all_cli(self):
     res = wayback(['--all-coll', 'all'])
     assert res.extra_config['collections']['all'] == '$all'
Esempio n. 13
0
 def test_proxy_cli_err_coll(self):
     with pytest.raises(Exception):
         res = wayback(['--proxy', 'test/foo'])
Esempio n. 14
0
 def test_proxy_cli_ts_err_invalid_ts(self):
     with pytest.raises(Exception):
         res = wayback(
             ['--proxy', 'test', '--proxy-default-timestamp', '2014abc'])
Esempio n. 15
0
 def test_all_cli(self):
     res = wayback(['--all-coll', 'all'])
     assert res.extra_config['collections']['all'] == '$all'
Esempio n. 16
0
 def test_proxy_cli_rec(self):
     res = wayback(['--proxy', 'test', '--proxy-record'])
     assert res.extra_config['proxy']['recording'] == True
     assert res.extra_config['collections']['live'] == {'index': '$live'}
Esempio n. 17
0
 def test_auto_fetch_cli(self):
     res = wayback(['--enable-auto-fetch'])
     assert res.extra_config['enable_auto_fetch'] == True
Esempio n. 18
0
 def test_proxy_cli_err_coll(self):
     with pytest.raises(Exception):
         res = wayback(['--proxy', 'test/foo'])
Esempio n. 19
0
 def test_proxy_cli_ts_err_invalid_ts(self):
     with pytest.raises(Exception):
         res = wayback(['--proxy', 'test', '--proxy-default-timestamp', '2014abc'])
Esempio n. 20
0
 def test_proxy_cli_rec(self):
     res = wayback(['--proxy', 'test', '--proxy-record'])
     assert res.extra_config['proxy']['recording'] == True
     assert res.extra_config['collections']['live'] == {'index': '$live'}
Esempio n. 21
0
 def test_proxy_cli_ts(self):
     res = wayback(
         ['--proxy', 'test', '--proxy-default-timestamp', '20140103000102'])
     assert res.application.proxy_default_timestamp == '20140103000102'