from .base_config_test import BaseConfigTest # ============================================================================ class TestLiveRewriter(BaseConfigTest): @classmethod def setup_class(cls): super(TestLiveRewriter, cls).setup_class('config_test.yaml') def test_live_live_1(self): headers = [('User-Agent', 'python'), ('Referer', 'http://localhost:80/live/other.example.com')] resp = self.testapp.get('/live/mp_/http://example.com/', headers=headers) assert resp.status_int == 200 def test_live_live_redirect_2(self): resp = self.testapp.get('/live/mp_/http://httpbin.org/redirect-to?url=http://example.com/') assert resp.status_int == 302 def test_live_live_post(self): resp = self.testapp.post('/live/mp_/httpbin.org/post', {'foo': 'bar', 'test': 'abc'}) assert resp.status_int == 200 resp.charset = 'utf-8' assert '"foo": "bar"' in resp.text assert '"test": "abc"' in resp.text assert resp.status_int == 200 def test_live_live_frame(self): resp = self.testapp.get('/live/http://example.com/') assert resp.status_int == 200 resp.charset = 'utf-8' assert '