def find(self, service_name, arguments=None, representation=None, **kwargs): representation = representation or self.representation args = arguments.copy() if arguments else dict() args.update(kwargs) return Cursor(self, service_name, representation, **args)
def random_cursor(mocker, random_response_dict): client = AppNexusClient("test", "test") mocker.patch.object(client, "get") client.get.side_effect = random_response_dict return Cursor(client, "campaign", representations.raw)
def test_uncallable_representation(): with pytest.raises(TypeError): Cursor("dumb", "dumb", 42)
def cursor(mocker, response_dict): client = AppNexusClient("test", "test") mocker.patch.object(client, 'get') client.get.return_value = response_dict return Cursor(client, "campaign", representations.raw)
def test_cursor_without_client(): with pytest.raises(RuntimeError): Cursor(None, None, None)