コード例 #1
0
ファイル: TestHttpData.py プロジェクト: lazerhawk/CertSlayer
 def test_httpresponse_repr(self):
     # Arrange
     r = "HTTP/1.1 200 OK\r\n"
     r += "Server: Apache/1.3.29 (Win32)\r\n"
     r += "\r\n"
     r += "<h1> Hi mom! </h1>"
     # Act
     httpdata = HttpResponse.parse(r)
     # Assert
     self.assertEquals(r, repr(httpdata))
コード例 #2
0
 def test_httpresponse_repr(self):
     # Arrange
     r = "HTTP/1.1 200 OK\r\n"
     r += "Server: Apache/1.3.29 (Win32)\r\n"
     r += "\r\n"
     r += "<h1> Hi mom! </h1>"
     # Act
     httpdata = HttpResponse.parse(r)
     # Assert
     self.assertEquals(r, repr(httpdata))
コード例 #3
0
ファイル: TestHttpData.py プロジェクト: lazerhawk/CertSlayer
 def test_httpresponse_multiplenewlines(self):
     # Arrange
     r = "HTTP/1.1 200 OK\r\n"
     r += "Date: Sun, 08 Feb xxxx 01:11:12 GMT\r\n"
     r += "Server: Apache/1.3.29 (Win32)\r\n"
     r += "Last-Modified: Sat, 07 Feb xxxx\r\n"
     r += "ETag: '0-23-4024c3a5'\r\n"
     r += "Accept-Ranges: bytes\r\n"
     r += "Content-Length: 35\r\n"
     r += "Connection: close\r\n"
     r += "Content-Type: text/html\r\n"
     r += "\r\n"
     r += "<h1> Hi\r\n\r\n\r\nmom! </h1>"
     # Act
     httpdata = HttpResponse.parse(r)
     # Assert
     self.assertEquals("<h1> Hi\r\n\r\n\r\nmom! </h1>", httpdata.body)
コード例 #4
0
 def test_httpresponse_multiplenewlines(self):
     # Arrange
     r = "HTTP/1.1 200 OK\r\n"
     r += "Date: Sun, 08 Feb xxxx 01:11:12 GMT\r\n"
     r += "Server: Apache/1.3.29 (Win32)\r\n"
     r += "Last-Modified: Sat, 07 Feb xxxx\r\n"
     r += "ETag: '0-23-4024c3a5'\r\n"
     r += "Accept-Ranges: bytes\r\n"
     r += "Content-Length: 35\r\n"
     r += "Connection: close\r\n"
     r += "Content-Type: text/html\r\n"
     r += "\r\n"
     r += "<h1> Hi\r\n\r\n\r\nmom! </h1>"
     # Act
     httpdata = HttpResponse.parse(r)
     # Assert
     self.assertEquals("<h1> Hi\r\n\r\n\r\nmom! </h1>", httpdata.body)