def test_request_is_created_from_valid_http_request(self): http_request = get_urllib2_request(uri=u'/sample?asd=dsa&qas=dsa') Request.from_urllib2_request( base_request=http_request, proxy_url=u'http://localhost', prefix=u'' ) self.assertEqual(Request.count(), 1)
def test_created_request_properties_match_source_request(self): http_request = get_urllib2_request(uri=u'/sample?asd=dsa&qas=dsa') request = Request.from_urllib2_request( base_request=http_request, proxy_url=u'http://localhost', prefix=u'' ) self.assertEqual(request.prefix, u'') self.assertEqual(request.key, u'/sample?asd=dsa&qas=dsa') self.assertEqual(request.proxy_url, u'http://localhost') self.assertEqual(request.method, u'GET') self.assertEqual(request.protocol, u'http') self.assertEqual(request.host, u'localhost') self.assertEqual(request.uri, u'/sample?asd=dsa&qas=dsa') self.assertEqual(request.path, u'/sample') self.assertEqual(request.query, u'asd=dsa&qas=dsa') self.assertEqual(request.body, u'')
def test_get_generic_request_urllib_Request_calls_(self, mocked_classmethod): http_request = get_urllib2_request() generic(http_request).get_generic_request() self.assertTrue(mocked_classmethod.called)