Example #1
0
 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)
Example #2
0
    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'')