1
0
mirror of https://github.com/webrecorder/pywb.git synced 2025-03-14 15:53:28 +01:00
pywb/tests_disabled/server_mock.py
Ilya Kreymer a4b770d34e new-pywb refactor!
frontendapp compatibility
- add support for separate not found page for 404s (not_found.html)
- support for exception handling with error template (error.html)
- support for home page (index.html)
- add memento headers for replay
- add referrer fallback check
- tests: port integration tests for front-end replay, cdx server
- not included: proxy mode, exact redirect mode, non-framed replay
- move unused tests to tests_disabled
- cli: add optional werkzeug profiler with --profile flag
2017-02-27 19:07:51 -08:00

37 lines
972 B
Python

from pywb.webapp.pywb_init import create_wb_router
from pywb.framework.wsgi_wrappers import init_app
from webtest import TestApp, TestResponse
app = None
testapp = None
def make_app(config_file, pywb_router=create_wb_router):
app = init_app(pywb_router,
load_yaml=True,
config_file=config_file)
testapp = TestApp(app)
class Resp(TestResponse):
def __init__(self, *args, **kwargs):
super(Resp, self).__init__(*args, **kwargs)
if self.headers.get('Content-Type'):
self.charset = 'utf-8'
TestApp.RequestClass.ResponseClass = Resp
return app, testapp
def make_setup_module(config, pywb_router=create_wb_router):
def setup_module():
global app
global testapp
app, testapp = make_app(config, pywb_router)
return setup_module
class BaseIntegration(object):
def setup(self):
self.app = app
self.testapp = testapp