def test_handler_order_block(self): '''Get an instance of the extended urllib and verify that the blacklist handler still works, even when mixed with all the other handlers.''' # Configure the handler blocked_url = URL('http://moth/abc/def/') cf.cf.save('non_targets', [blocked_url,]) settings = opener_settings.OpenerSettings() settings.build_openers() opener = settings.get_custom_opener() request = HTTPRequest(blocked_url) request.url_object = blocked_url request.cookies = True request.get_from_cache = False response = opener.open(request) self.assertEqual(response.code, NO_CONTENT) self.assertEqual(response.id, 1)
def test_handler_order_block(self): '''Get an instance of the extended urllib and verify that the blacklist handler still works, even when mixed with all the other handlers.''' # Configure the handler blocked_url = URL('http://moth/abc/def/') cf.cf.save('non_targets', [ blocked_url, ]) settings = opener_settings.OpenerSettings() settings.build_openers() opener = settings.get_custom_opener() request = HTTPRequest(blocked_url) request.url_object = blocked_url request.cookies = True request.get_from_cache = False response = opener.open(request) self.assertEqual(response.code, NO_CONTENT) self.assertEqual(response.id, 1)