Skip to content
Myr

add query data yourself, foo'

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

  • other:+20 added−24 removed

1 file+20 added−24 removed

modified:test_requests.py+20 added-24 removed
321 unmodified lines
322 self.assertEquals(rbody.get('form'), {}) # No form supplied323 self.assertEquals(rbody.get('data'), '')324325326 def test_nonurlencoded_post_querystring(self):327328 for service in SERVICES:329330 r = requests.post(service('post'), params='fooaowpeuf')331332 self.assertEquals(r.status_code, 200)333 self.assertEquals(r.headers['content-type'], 'application/json')334 self.assertEquals(r.url, service('post?fooaowpeuf'))335336 rbody = json.loads(r.content)337 self.assertEquals(rbody.get('form'), {}) # No form supplied338 self.assertEquals(rbody.get('data'), '')339340326 def test_urlencoded_post_query_and_data(self):327328 for service in SERVICES:329
10 unmodified lines
340 self.assertEquals(rbody.get('form'), dict(test2='foobar'))341 self.assertEquals(rbody.get('data'), '')342343359 def test_nonurlencoded_post_query_and_data(self):344 def test_nonurlencoded_postdata(self):345346 for service in SERVICES:347363 r = requests.post(service('post'),364 params='fooaowpeuf', data="foobar")348 r = requests.post(service('post'), data="foobar")349350 self.assertEquals(r.status_code, 200)351 self.assertEquals(r.headers['content-type'], 'application/json')368 self.assertEquals(r.url, service('post?fooaowpeuf'))352353 rbody = json.loads(r.content)354355 self.assertEquals(rbody.get('form'), None)
165 unmodified lines
521 assert not params['a'] in r3.content522 assert params3['b'] in r3.content523 assert params3['c'] in r3.content524525526 def test_cookies(self):527528 s = requests.session()529 r = s.get(httpbin('cookies', 'set', 'face', 'book'))546 print r.headers547 print r.history[0].cookies548 print r.content549 print r.url530 # print r.headers531 # print r.history[0].cookies532 # print r.content533 # print r.url534535536 def test_invalid_content(self):537538 # WARNING: if you're using a terrible DNS provider (comcast),539 # this will fail.555 r = requests.get('http://somedomainthatclearlydoesntexistg.com', allow_redirects=False)540 try:541 hah = 'http://somedomainthatclearlydoesntexistg.com'542 r = requests.get(hah, allow_redirects=False)543 except requests.ConnectionError:544 pass # \o/545 else:546 assert False547548549 config = {'safe_mode': True}550 r = requests.get(hah, allow_redirects=False, config=config)551 assert r.content == None552553554555556557if __name__ == '__main__':558 unittest.main()