mirror of
https://github.com/webrecorder/pywb.git
synced 2025-03-15 08:04:49 +01:00
49 lines
2.1 KiB
Python
49 lines
2.1 KiB
Python
from .base_config_test import BaseConfigTest, fmod
|
|
|
|
|
|
# ============================================================================
|
|
class TestForceHttps(BaseConfigTest):
|
|
@classmethod
|
|
def setup_class(cls):
|
|
super(TestForceHttps, cls).setup_class('config_test.yaml',
|
|
custom_config={'force_scheme': 'https'})
|
|
|
|
def test_force_https_replay_1(self, fmod):
|
|
resp = self.get('/pywb/20140128051539{0}/http://example.com/', fmod)
|
|
|
|
assert '"https://localhost:80/pywb/20140128051539{0}/http://www.iana.org/domains/example"'.format(fmod) in resp.text, resp.text
|
|
|
|
|
|
# ============================================================================
|
|
class TestForceHttpsRedirect(BaseConfigTest):
|
|
@classmethod
|
|
def setup_class(cls):
|
|
super(TestForceHttpsRedirect, cls).setup_class('config_test_redirect_classic.yaml',
|
|
custom_config={'force_scheme': 'https'})
|
|
|
|
def test_force_https_redirect_replay_1(self, fmod):
|
|
resp = self.get('/pywb/20140128051539{0}/http://example.com/', fmod)
|
|
|
|
assert resp.headers['Location'] == 'https://localhost:80/pywb/20140127171251{0}/http://example.com'.format(fmod)
|
|
resp = resp.follow()
|
|
|
|
assert resp.headers['Location'] == 'https://localhost:80/pywb/20140127171251{0}/http://example.com/'.format(fmod)
|
|
resp = resp.follow()
|
|
|
|
assert '"https://localhost:80/pywb/20140127171251{0}/http://www.iana.org/domains/example"'.format(fmod) in resp.text, resp.text
|
|
|
|
|
|
# ============================================================================
|
|
class TestForceHttpsRoot(BaseConfigTest):
|
|
@classmethod
|
|
def setup_class(cls):
|
|
super(TestForceHttpsRoot, cls).setup_class('config_test_root_coll.yaml',
|
|
custom_config={'force_scheme': 'https'})
|
|
|
|
def test_force_https_root_replay_1(self, fmod):
|
|
resp = self.get('/20140128051539{0}/http://www.iana.org/domains/example', fmod)
|
|
|
|
assert resp.headers['Location'] == 'https://localhost:80/20140128051539{0}/https://www.iana.org/domains/reserved'.format(fmod)
|
|
|
|
|