Skip to content
Myr

WHITESPACE

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 cd0d0a2 · Browse files · 1 file+20 added−20 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+20 added−20 removed

  • other:+20 added−20 removed

1 file+20 added−20 removed

modified:test_requests.py+20 added-20 removed
13 unmodified lines
1415 def setUp(self):16 pass1718 1819 def tearDown(self):20 """Teardown."""21 pass2223 2324 def test_invalid_url(self):25 self.assertRaises(ValueError, requests.get, 'hiwpefhipowhefopw')2627 2728 def test_HTTP_200_OK_GET(self):29 r = requests.get('http://google.com')30 self.assertEqual(r.status_code, 200)3132 3233 def test_HTTPS_200_OK_GET(self):34 r = requests.get('https://google.com')35 self.assertEqual(r.status_code, 200)3637 3738 def test_HTTP_200_OK_GET_WITH_PARAMS(self):39 heads = {'User-agent': 'Mozilla/5.0'}4041 r = requests.get('http://www.google.com/search', params={'q': 'test'}, headers=heads)42 self.assertEqual(r.status_code, 200)4344 4445 def test_HTTP_200_OK_GET_WITH_MIXED_PARAMS(self):46 heads = {'User-agent': 'Mozilla/5.0'}4748 r = requests.get('http://google.com/search?test=true', params={'q': 'test'}, headers=heads)49 self.assertEqual(r.status_code, 200)5051 5152 def test_user_agent_transfers(self):53 """Issue XX"""54 heads = {55 'User-agent':
10 unmodified lines
6667 r = requests.get('http://whatsmyua.com', headers=heads);68 self.assertTrue(heads['user-agent'] in r.content)6970 7071 def test_HTTP_200_OK_HEAD(self):72 r = requests.head('http://google.com')73 self.assertEqual(r.status_code, 200)7475 7576 def test_HTTPS_200_OK_HEAD(self):77 r = requests.head('https://google.com')78 self.assertEqual(r.status_code, 200)7980 8081 def test_AUTH_HTTPS_200_OK_GET(self):82 auth = ('requeststest', 'requeststest')83 url = 'https://convore.com/api/account/verify.json'84 r = requests.get(url, auth=auth)
5 unmodified lines
9091 # reset auto authentication92 requests.auth_manager.empty()9394 9495 def test_POSTBIN_GET_POST_FILES(self):96 bin = requests.post('http://www.postbin.org/')97 self.assertEqual(bin.status_code, 302)98
36 unmodified lines
135136 r = requests.get('http://google.com/')137 self.assertEqual(bool(r), True)138139 139140 def test_request_ok_set(self):141 r = requests.get('http://google.com/some-404-url')142 self.assertEqual(r.ok, False)143144 144145 def test_status_raising(self):146 r = requests.get('http://google.com/some-404-url')147 self.assertRaises(requests.HTTPError, r.raise_for_status)148149 r = requests.get('http://google.com/')150 self.assertFalse(r.error)151 r.raise_for_status()152153 153154 def test_cookie_jar(self):155 """156 .. todo:: This really doesn't test to make sure the cookie is working157 """
3 unmodified lines
161162 requests.get('http://google.com', cookies=jar)163 self.assertTrue(jar)164165 165166 def test_decompress_gzip(self):167168 r = requests.get('http://api.stackoverflow.com/1.1/users/495995/top-answer-tags')169 r.content.decode('ascii')170171 171172 def test_autoauth(self):173174 conv_auth = ('requeststest', 'requeststest')175 requests.auth_manager.add_auth('convore.com', conv_auth)176177 r = requests.get('https://convore.com/api/account/verify.json')178 self.assertEquals(r.status_code, 200)179180 180181 def test_unicode_get(self):182 182183 requests.get('http://google.com', params={'foo': u'føø'})184 requests.get('http://google.com', params={u'føø': u'føø'})185 requests.get('http://google.com', params={'føø': 'føø'})186 requests.get('http://google.com', params={'foo': u'foo'})187 requests.get('http://google.com/ø', params={'foo': u'foo'})188189 189190 def test_httpauth_recursion(self):191 conv_auth = ('requeststest', 'bad_password')192193 r = requests.get('https://convore.com/api/account/verify.json', auth=conv_auth)194 self.assertEquals(r.status_code, 401)195196 196197 def test_settings(self):198 with requests.settings(timeout=0.0001):199 self.assertRaises(requests.Timeout, requests.get, 'http://google.com')200
11 unmodified lines