Commits

Anonymous committed 9442f33

fix tests

Comments (0)

Files changed (3)

tests/_server_test.py

             body = self.rfile.read(content_length)
             self._respond(200, extra_headers, body)
 
+        elif path == "/bytestring":
+            content_type = self.headers.get('content-type', 'text/plain')
+            extra_headers.append(('Content-type', content_type))
+            content_length = int(self.headers.get('Content-length', '-1'))
+            body = self.rfile.read(content_length)
+            self._respond(200, extra_headers, body)
+
         elif path == "/unicode":
             content_type = self.headers.get('content-type', 'text/plain')
             extra_headers.append(('Content-type', content_type))

tests/resource_test.py

         result = self.res.post(payload="test")
         self.assert_(result=="test")
 
+    def testPostByteString(self):
+        result = self.res.post('/bytestring', payload="éàù@")
+        self.assert_(result == "éàù@")
+
     def testPostUnicode(self):
-        result = self.res.get('/unicode', payload=u"éàù@")
+        result = self.res.post('/unicode', payload=u"éàù@")
         self.assert_(result == u"éàù@")
 
     def testPostWithContentType(self):

tests/transports_test.py

         self.assert_(result == "welcome")
 
     def testUnicode(self):
-        result = self.res.get('/unicode')
+        result = self.res.post('/unicode')
         self.assert_(result == u"éàù@")
 
+    def testPostByteString(self):
+        result = self.res.post('/bytestring', payload="éàù@")
+        self.assert_(result == "éàù@")
+
     def testGetWithContentType(self):
         result = self.res.get('/json', headers={'Content-Type': 'application/json'})
         self.assert_(result.http_code == 200)