proper PATCH testing
authorKenneth Reitz <me@kennethreitz.com>
Tue, 21 Jun 2011 22:24:28 +0000 (18:24 -0400)
committerKenneth Reitz <me@kennethreitz.com>
Tue, 21 Jun 2011 22:24:28 +0000 (18:24 -0400)
test_requests.py

index 153c6d9..aa2577d 100755 (executable)
@@ -15,6 +15,8 @@ import requests
 HTTPBIN_URL = 'http://httpbin.org/'
 HTTPSBIN_URL = 'https://httpbin.ep.io/'
 
+# HTTPBIN_URL = 'http://staging.httpbin.org/'
+# HTTPSBIN_URL = 'https://httpbin-staging.ep.io/'
 
 
 def httpbin(*suffix):
@@ -103,6 +105,26 @@ class RequestsTestSuite(unittest.TestCase):
         self.assertEqual(r.status_code, 200)
 
 
+    def test_HTTP_200_OK_PUT(self):
+        r = requests.put(httpbin('put'))
+        self.assertEqual(r.status_code, 200)
+
+
+    def test_HTTPS_200_OK_PUT(self):
+        r = requests.put(httpsbin('put'))
+        self.assertEqual(r.status_code, 200)
+
+
+    def test_HTTP_200_OK_PATCH(self):
+        r = requests.patch(httpbin('patch'))
+        self.assertEqual(r.status_code, 200)
+
+
+    def test_HTTPS_200_OK_PATCH(self):
+        r = requests.patch(httpsbin('patch'))
+        self.assertEqual(r.status_code, 200)
+
+
     def test_AUTH_HTTPS_200_OK_GET(self):
         auth = ('user', 'pass')
         url = httpsbin('basic-auth', 'user', 'pass')
@@ -131,20 +153,6 @@ class RequestsTestSuite(unittest.TestCase):
         self.assertEqual(post3.status_code, 200)
 
 
-    def test_POSTBIN_GET_PATCH_FILES(self):
-        url = httpbin('patch')
-        patch = requests.patch(url).raise_for_status()
-
-        patch = requests.post(url, data={'some': 'data'})
-        self.assertEqual(patch.status_code, 200)
-
-        patch2 = requests.post(url, files={'some': open('test_requests.py')})
-        self.assertEqual(patch2.status_code, 200)
-
-        patch3 = requests.post(url, data='[{"some": "json"}]')
-        self.assertEqual(patch3.status_code, 200)
-
-
     def test_POSTBIN_GET_POST_FILES_WITH_PARAMS(self):
 
         url = httpbin('post')