Ejemplo n.º 1
0
 def test_requests_pedantically(self):
     given_url = "http://httpbin.org/get"
     given_method = "GET"
     given_headers = {"User-Agent": "Charmander/1.0"}
     given_cookies = {"__utm_soul_tracking_id": "A941ECF10959101"}
     given_request = requests.models.Request(url=given_url, method=given_method, headers=given_headers, cookies=given_cookies)
     given_srequest = requestions.write_request(given_request)
     request = requestions.read_request(given_srequest)
     self.assertEqual(request.url, given_request.url)
     self.assertEqual(request.headers, given_headers)
     self.assertEqual(request.method, given_method)
     self.assertEqual(dict(request.cookies), given_cookies)
Ejemplo n.º 2
0
 def test_read_request_url(self):
     given_url = "http://httpbin.org/get"
     srequest = json.dumps({"url": given_url})
     request = requestions.read_request(srequest)
     self.assertEqual(given_url, request.url)