コード例 #1
0
ファイル: test_request.py プロジェクト: crsharat/dragline
 def test_cookie(self):
     response = Request(httpbin('cookies', 'set?name=dragline')).send()
     response = Request(httpbin('cookies'), cookies=response.cookies).send()
     self.assertEqual(response.json()['cookies']['name'], 'dragline')
     response = Request(httpbin('/cookies/delete?name')).send()
     response = Request(httpbin('cookies'), cookies={'name': 'dragline2'}).send()
     self.assertEqual(response.json()['cookies']['name'], 'dragline2')
コード例 #2
0
ファイル: test_request.py プロジェクト: crsharat/dragline
 def test_redirect(self):
     response = Request(httpbin('redirect', '4')).send()
     self.assertEqual(httpbin('get'), response.json()['url'])
     self.assertEqual(response.status_code, 200)
     response = Request(httpbin('redirect', '4'), allow_redirects=False).send()
     self.assertEqual(response.status_code, 302)
コード例 #3
0
ファイル: test_request.py プロジェクト: crsharat/dragline
 def test_headers(self):
     headers = {"user-agent": "dragline"}
     response = Request(httpbin('user-agent'), headers=headers).send()
     self.assertEqual(headers, response.json())
コード例 #4
0
ファイル: test_request.py プロジェクト: crsharat/dragline
 def test_post_raw(self):
     data = 'dragline'
     response = Request(httpbin('post'), data=data).send()
     self.assertEqual(data, response.json()['data'])
コード例 #5
0
ファイル: test_request.py プロジェクト: crsharat/dragline
 def test_post_form(self):
     data = {'name': 'dragline'}
     response = Request(httpbin('post'), data=data).send()
     self.assertEqual(data, response.json()['form'])
コード例 #6
0
ファイル: test_request.py プロジェクト: crsharat/dragline
 def test_get(self):
     response = Request(httpbin('get')).send()
     self.assertEqual(httpbin('get'), response.json()['url'])