mirror of
https://github.com/webrecorder/pywb.git
synced 2025-03-15 00:03:28 +01:00
Rename: - rename auto-fetch config to 'enable_auto_fetch' and '--enable-auto-fetch' cli param - rename 'use_head_insert' -> 'enable_content_rewrite' - rename 'use_banner' -> 'enable_banner' - rename 'use_wombat' -> 'enable_wombat' Misc Cleanup: - enable_auto_fetch applies to both proxy and non-proxy mode - remove setting 'wbinfo.use_wombat', implied if wombatProxyMode.js is included - docs: add docs for auto-fetch system, improved docs for proxy rewrite options - tests: test with enable_auto_fetch, update tests for renames - bump version to 2.1.0 due to breaking changes - changelist: updates to changelist - requirements: use bounded version for gevent
44 lines
1.4 KiB
Python
44 lines
1.4 KiB
Python
import os
|
|
from mock import patch
|
|
|
|
import pytest
|
|
|
|
from pywb.apps.cli import wayback
|
|
from .base_config_test import CollsDirMixin, BaseTestClass
|
|
|
|
|
|
# ============================================================================
|
|
def _run_patch(self):
|
|
return self
|
|
|
|
|
|
@patch('pywb.apps.cli.ReplayCli.run', _run_patch)
|
|
class TestProxyCLIConfig(CollsDirMixin, BaseTestClass):
|
|
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}
|
|
assert res.extra_config['proxy'] == exp
|
|
|
|
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'}
|
|
|
|
def test_proxy_cli_err_coll(self):
|
|
with pytest.raises(Exception):
|
|
res = wayback(['--proxy', 'test/foo'])
|
|
|
|
def test_all_cli(self):
|
|
res = wayback(['--all-coll', 'all'])
|
|
assert res.extra_config['collections']['all'] == '$all'
|
|
|
|
def test_live_all_cli(self):
|
|
res = wayback(['--all-coll', 'all', '--live'])
|
|
assert res.extra_config['collections'] == {'live': {'index': '$live'},
|
|
'all': '$all'}
|
|
|