Skip to content
Myr

leave room for _

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 7ad08c5 · Browse files · 1 file+10 added−0 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+10 added−0 removed

  • other:+10 added−0 removed

1 file+10 added−0 removed

modified:test_requests.py+10 added
18 unmodified lines
19 20 def test_invalid_url(self):21 self.assertRaises(ValueError, requests.get, 'hiwpefhipowhefopw')222324 def test_HTTP_200_OK_GET(self):25 r = requests.get('http://google.com')26 self.assertEqual(r.status_code, 200)272829 def test_HTTPS_200_OK_GET(self):30 r = requests.get('https://google.com')31 self.assertEqual(r.status_code, 200)323334 def test_HTTP_200_OK_HEAD(self):35 r = requests.head('http://google.com')36 self.assertEqual(r.status_code, 200)373839 def test_HTTPS_200_OK_HEAD(self):40 r = requests.head('https://google.com')41 self.assertEqual(r.status_code, 200)424344 def test_AUTH_HTTPS_200_OK_GET(self):45 auth = requests.AuthObject('requeststest', 'requeststest')46 url = 'https://convore.com/api/account/verify.json'47 r = requests.get(url, auth=auth)4849 self.assertEqual(r.status_code, 200)505152 def test_POSTBIN_GET_POST_FILES(self):5354 bin = requests.post('http://www.postbin.org/')55 self.assertEqual(bin.status_code, 200)
3 unmodified lines
5960 post2 = requests.post(bin.url, files={'some': StringIO('data')})61 self.assertEqual(post2.status_code, 201)626364 def test_nonzero_evaluation(self):65 r = requests.get('http://google.com/some-404-url')66 self.assertEqual(bool(r), False)67 68 r = requests.get('http://google.com/')69 self.assertEqual(bool(r), True)707172 def test_request_ok_set(self):73 r = requests.get('http://google.com/some-404-url')74 self.assertEqual(r.ok, False)757677 def test_status_raising(self):78 r = requests.get('http://google.com/some-404-url')79 self.assertRaises(requests.HTTPError, r.raise_for_status)8081 r = requests.get('http://google.com/')82 self.assertFalse(r.error)83 r.raise_for_status()848586if __name__ == '__main__':87 unittest.main()