1
0
mirror of https://github.com/webrecorder/pywb.git synced 2025-03-15 00:03:28 +01:00
pywb/tests/test_prefixed_deploy.py
Ilya Kreymer 9f81933fbd
wombat reinit fix (#383)
* wombat init fix:
- fix change from #339 which removed reiniting of wombat
- allow reiniting of wombat if inited via init_new_window_wombat()
- don't allow if reinited directly from <head>, as happened in document import

* tests: fix tests for 'new _WBWombat -> WombatInit' change

* wombat: window.frames optimization:
- since window.frames === window, no need for separate override!
- ensure init_new_window_wombat() is called on any returned window from object proxy
2018-10-04 17:29:18 -04:00

51 lines
1.9 KiB
Python

from .base_config_test import BaseConfigTest, fmod
# ============================================================================
class TestPrefixedDeploy(BaseConfigTest):
@classmethod
def setup_class(cls):
super(TestPrefixedDeploy, cls).setup_class('config_test.yaml')
def get(self, url, fmod=''):
return super(TestPrefixedDeploy, self).get(url, fmod,
extra_environ={'SCRIPT_NAME': '/prefix',
'REQUEST_URI': 'http://localhost:80/prefix' + url})
def test_home(self):
resp = self.get('/prefix/')
print(resp.text)
self._assert_basic_html(resp)
assert '/prefix/pywb' in resp.text
def test_pywb_root(self):
resp = self.get('/prefix/pywb/')
self._assert_basic_html(resp)
assert 'Search' in resp.text
def test_calendar_query(self):
resp = self.get('/prefix/pywb/*/iana.org')
self._assert_basic_html(resp)
assert '/prefix/static/query.js' in resp.text
def test_replay_content(self, fmod):
resp = self.get('/prefix/pywb/20140127171238{0}/http://www.iana.org/', fmod)
self._assert_basic_html(resp)
assert '"20140127171238"' in resp.text, resp.text
assert "'http://localhost:80/prefix/static/wombat.js'" in resp.text
assert "'http://localhost:80/prefix/static/default_banner.js'" in resp.text
assert '"http://localhost:80/prefix/static/"' in resp.text
assert '"http://localhost:80/prefix/pywb/"' in resp.text
assert 'WBWombatInit' in resp.text, resp.text
assert '"/prefix/pywb/20140127171238{0}/http://www.iana.org/time-zones"'.format(fmod) in resp.text, resp.text
def test_static_content(self):
resp = self.get('/prefix/static/default_banner.css')
assert resp.status_int == 200
assert resp.content_type == 'text/css'
assert resp.content_length > 0