Created
January 13, 2016 11:20
-
-
Save jerith/b72b06993cbd451ab282 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from twisted.trial import unittest | |
| from twisted.test import proto_helpers | |
| from vumi_http_proxy.http_proxy import ProxyFactory | |
| class CheckProxyRequestTestCase(unittest.TestCase): | |
| def test_process(self): | |
| factory = ProxyFactory() | |
| proto = factory.buildProtocol(('0.0.0.0', 0)) | |
| tr = proto_helpers.StringTransport() | |
| proto.makeConnection(tr) | |
| proto.dataReceived("\r\n".join([ | |
| "GET http://zombo.com/ HTTP/1.1", | |
| "Host: zombo.com", | |
| "", | |
| "", | |
| ])) | |
| self.assertEqual(tr.value(), "\r\n".join([ | |
| "HTTP/1.1 200 OK", | |
| "Transfer-Encoding: chunked", | |
| "", | |
| "13", | |
| "<html>Denied</html>", | |
| "0", | |
| "", | |
| "", | |
| ])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment