Skip to content
Myr

proper PATCH testing

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Kenneth Reitz · committed by Kenneth Reitz · parent 00f066a · Browse files · 1 file+22 added−14 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+22 added−14 removed

  • other:+22 added−14 removed

1 file+22 added−14 removed

modified:test_requests.py+22 added-14 removed
13 unmodified lines
1415HTTPBIN_URL = 'http://httpbin.org/'16HTTPSBIN_URL = 'https://httpbin.ep.io/'1718# HTTPBIN_URL = 'http://staging.httpbin.org/'19# HTTPSBIN_URL = 'https://httpbin-staging.ep.io/'202122def httpbin(*suffix):23 """Returns url for HTTPBIN resource."""
80 unmodified lines
104 r = requests.head(httpsbin('/'))105 self.assertEqual(r.status_code, 200)106107108 def test_HTTP_200_OK_PUT(self):109 r = requests.put(httpbin('put'))110 self.assertEqual(r.status_code, 200)111112113 def test_HTTPS_200_OK_PUT(self):114 r = requests.put(httpsbin('put'))115 self.assertEqual(r.status_code, 200)116117118 def test_HTTP_200_OK_PATCH(self):119 r = requests.patch(httpbin('patch'))120 self.assertEqual(r.status_code, 200)121122123 def test_HTTPS_200_OK_PATCH(self):124 r = requests.patch(httpsbin('patch'))125 self.assertEqual(r.status_code, 200)126127128 def test_AUTH_HTTPS_200_OK_GET(self):129 auth = ('user', 'pass')130 url = httpsbin('basic-auth', 'user', 'pass')131 r = requests.get(url, auth=auth)
20 unmodified lines
152 post3 = requests.post(url, data='[{"some": "json"}]')153 self.assertEqual(post3.status_code, 200)154155134 def test_POSTBIN_GET_PATCH_FILES(self):135 url = httpbin('patch')136 patch = requests.patch(url).raise_for_status()137138 patch = requests.post(url, data={'some': 'data'})139 self.assertEqual(patch.status_code, 200)140141 patch2 = requests.post(url, files={'some': open('test_requests.py')})142 self.assertEqual(patch2.status_code, 200)143144 patch3 = requests.post(url, data='[{"some": "json"}]')145 self.assertEqual(patch3.status_code, 200)146147156 def test_POSTBIN_GET_POST_FILES_WITH_PARAMS(self):157158 url = httpbin('post')159 post = requests.post(url, files={'some': open('test_requests.py')}, data={'some': 'data'})
163 unmodified lines