use gunicorn to serve tests
authorKenneth Reitz <me@kennethreitz.com>
Sat, 15 Oct 2011 16:30:49 +0000 (12:30 -0400)
committerKenneth Reitz <me@kennethreitz.com>
Sat, 15 Oct 2011 16:30:49 +0000 (12:30 -0400)
test_requests.py

index 2b28319..51661df 100755 (executable)
@@ -3,8 +3,11 @@
 
 from __future__ import with_statement
 
-import unittest
+import time
 import cookielib
+import unittest
+
+import envoy
 
 try:
     import omnijson as json
@@ -16,7 +19,8 @@ import requests
 from requests.sessions import Session
 
 
-HTTPBIN_URL = 'http://127.0.0.1:44444/'
+HTTPBIN_URL = 'http://0.0.0.0:7045/'
+# HTTPBIN_URL = 'http://127.0.0.1:8000/'
 
 
 def httpbin(*suffix):
@@ -40,14 +44,10 @@ class RequestsTestSuite(unittest.TestCase):
         global _httpbin
 
         if not _httpbin:
-            import envoy
-            self.httpbin = envoy.connect('httpbin 44444')
-            # print self.httpbin
 
-            _httpbin = True
-            # print '!'/
+            self.httpbin = envoy.connect('gunicorn httpbin:app --bind=0.0.0.0:7045')
 
-            import time
+            _httpbin = True
             time.sleep(1)
 
 
@@ -122,6 +122,9 @@ class RequestsTestSuite(unittest.TestCase):
 
     def test_HTTP_200_OK_PATCH(self):
         r = requests.patch(httpbin('patch'))
+        print r.__dict__
+        print r.content
+        print r.url
         self.assertEqual(r.status_code, 200)