def topic(self, callback): url = self.get_url('/') loader.http_client = self._http_client config = Config() config.HTTP_LOADER_FORWARD_USER_AGENT = True config.HTTP_LOADER_DEFAULT_USER_AGENT = "DEFAULT_USER_AGENT" ctx = Context(None, config, None, HandlerMock({})) loader.load(ctx, url, callback)
async def test_load_with_default_user_agent(self): url = self.get_url("/") config = Config() config.HTTP_LOADER_FORWARD_USER_AGENT = True config.HTTP_LOADER_DEFAULT_USER_AGENT = "DEFAULT_USER_AGENT" ctx = Context(None, config, None, HandlerMock({})) result = await loader.load(ctx, url) expect(result).to_be_instance_of(LoaderResult) expect(result.buffer).to_equal("DEFAULT_USER_AGENT")
def test_load_with_default_user_agent(self): url = self.get_url('/') config = Config() config.HTTP_LOADER_FORWARD_USER_AGENT = True config.HTTP_LOADER_DEFAULT_USER_AGENT = "DEFAULT_USER_AGENT" ctx = Context(None, config, None, HandlerMock({})) loader.load(ctx, url, self.stop) result = self.wait() expect(result).to_be_instance_of(LoaderResult) expect(result.buffer).to_equal('DEFAULT_USER_AGENT')