mirror of
https://github.com/webrecorder/pywb.git
synced 2025-03-24 06:59:52 +01:00
proxy: switching not available for ip resolver either
tests: update tests for auth and ip resolver to check that proxy magic is not set
This commit is contained in:
parent
e9b11fcbf2
commit
381f350917
@ -123,7 +123,7 @@ class IPCacheResolver(BaseCollResolver):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def supports_switching(self):
|
def supports_switching(self):
|
||||||
return True
|
return False
|
||||||
|
|
||||||
def _get_ip(self, env):
|
def _get_ip(self, env):
|
||||||
ip = env['REMOTE_ADDR']
|
ip = env['REMOTE_ADDR']
|
||||||
|
@ -22,6 +22,9 @@ class TestProxyHttpAuth(BaseIntegration):
|
|||||||
assert resp.content_type == 'text/plain'
|
assert resp.content_type == 'text/plain'
|
||||||
assert resp.content_length > 0
|
assert resp.content_length > 0
|
||||||
|
|
||||||
|
assert 'proxy_magic = ""' in resp.body
|
||||||
|
assert 'wb.js' in resp.body
|
||||||
|
|
||||||
# 'Simulating' proxy by settings REQUEST_URI explicitly to http:// url and no SCRIPT_NAME
|
# 'Simulating' proxy by settings REQUEST_URI explicitly to http:// url and no SCRIPT_NAME
|
||||||
# would be nice to be able to test proxy more
|
# would be nice to be able to test proxy more
|
||||||
def test_proxy_replay(self):
|
def test_proxy_replay(self):
|
||||||
@ -29,7 +32,6 @@ class TestProxyHttpAuth(BaseIntegration):
|
|||||||
self._assert_basic_html(resp)
|
self._assert_basic_html(resp)
|
||||||
|
|
||||||
assert '"20140126201127"' in resp.body
|
assert '"20140126201127"' in resp.body
|
||||||
assert 'wb.js' in resp.body
|
|
||||||
|
|
||||||
def test_proxy_replay_auth_filtered(self):
|
def test_proxy_replay_auth_filtered(self):
|
||||||
headers = [('Proxy-Authorization', 'Basic ' + base64.b64encode('pywb-filt-2:'))]
|
headers = [('Proxy-Authorization', 'Basic ' + base64.b64encode('pywb-filt-2:'))]
|
||||||
@ -39,7 +41,6 @@ class TestProxyHttpAuth(BaseIntegration):
|
|||||||
self._assert_basic_html(resp)
|
self._assert_basic_html(resp)
|
||||||
|
|
||||||
assert '"20140126200624"' in resp.body
|
assert '"20140126200624"' in resp.body
|
||||||
assert 'wb.js' in resp.body
|
|
||||||
|
|
||||||
def test_proxy_replay_auth(self):
|
def test_proxy_replay_auth(self):
|
||||||
headers = [('Proxy-Authorization', 'Basic ' + base64.b64encode('pywb'))]
|
headers = [('Proxy-Authorization', 'Basic ' + base64.b64encode('pywb'))]
|
||||||
@ -49,7 +50,6 @@ class TestProxyHttpAuth(BaseIntegration):
|
|||||||
self._assert_basic_html(resp)
|
self._assert_basic_html(resp)
|
||||||
|
|
||||||
assert '"20140127171238"' in resp.body
|
assert '"20140127171238"' in resp.body
|
||||||
assert 'wb.js' in resp.body
|
|
||||||
|
|
||||||
def test_proxy_replay_auth_no_coll(self):
|
def test_proxy_replay_auth_no_coll(self):
|
||||||
headers = [('Proxy-Authorization', 'Basic ' + base64.b64encode('no-such-coll'))]
|
headers = [('Proxy-Authorization', 'Basic ' + base64.b64encode('no-such-coll'))]
|
||||||
|
@ -18,6 +18,7 @@ class TestProxyIPResolver(BaseIntegration):
|
|||||||
assert resp.status_int == 200
|
assert resp.status_int == 200
|
||||||
assert resp.content_type == 'text/html'
|
assert resp.content_type == 'text/html'
|
||||||
assert resp.content_length > 0
|
assert resp.content_length > 0
|
||||||
|
assert 'proxy_magic = ""' in resp.body
|
||||||
|
|
||||||
def _assert_basic_text(self, resp):
|
def _assert_basic_text(self, resp):
|
||||||
assert resp.status_int == 200
|
assert resp.status_int == 200
|
||||||
|
Loading…
x
Reference in New Issue
Block a user