mirror of
https://github.com/webrecorder/pywb.git
synced 2025-03-20 18:59:11 +01:00
44 lines
1.4 KiB
Python
44 lines
1.4 KiB
Python
|
|
from webagg.test.testutils import LiveServerTests, BaseTestClass
|
|
from webagg.test.testutils import FakeRedisTests
|
|
|
|
from .simpleapp import RWApp, debug
|
|
|
|
import os
|
|
import webtest
|
|
|
|
|
|
class TestRewriter(LiveServerTests, FakeRedisTests, BaseTestClass):
|
|
@classmethod
|
|
def setup_class(cls):
|
|
super(TestRewriter, cls).setup_class()
|
|
#cls.upstream_url = 'http://localhost:{0}'.format(cls.server.port)
|
|
#cls.upstream_url += '/{type}/resource/postreq?url={url}&closest={closest}'
|
|
#cls.app = RWApp(cls.upstream_url)
|
|
|
|
cls.app = RWApp.create_app(replay_port=cls.server.port)
|
|
cls.testapp = webtest.TestApp(cls.app.app)
|
|
debug(True)
|
|
|
|
def test_replay(self):
|
|
resp = self.testapp.get('/live/mp_/http://example.com/')
|
|
resp.charset = 'utf-8'
|
|
|
|
assert '"http://localhost:80/live/mp_/http://www.iana.org/domains/example"' in resp.text
|
|
|
|
assert 'wbinfo.url = "http://example.com/"'
|
|
|
|
def test_top_frame(self):
|
|
resp = self.testapp.get('/live/http://example.com/')
|
|
resp.charset = 'utf-8'
|
|
|
|
assert '"http://localhost:80/live/mp_/http://example.com/"' in resp.text
|
|
|
|
assert 'wbinfo.capture_url = "http://example.com/"' in resp.text
|
|
|
|
def test_cookie_track_1(self):
|
|
resp = self.testapp.get('/live/mp_/https://twitter.com/')
|
|
|
|
assert resp.headers['set-cookie'] != None
|
|
|