def delete_policy(self, request, log, tenant_id, group_id, policy_id): """Delete a policy. :param str tenant_id: A tenant id :param str group_id: A groud id :param str policy_id: A policy id """ d = cass.delete_policy(self._db, group_id, policy_id) def finish(_): request.setHeader('Content-Type', 'application/json') request.setResponseCode(204) request.finish() return d.addCallback(finish)
def test_delete_policy(self): """Deletes a policy.""" def execute(*args, **kwargs): return defer.succeed(None) self.client.execute.side_effect = execute d = cass.delete_policy(self.client, 'group-xyz', 'policy-abc') self.successResultOf(d) calls = [ mock.call( 'DELETE FROM policies WHERE "groupId"=:groupId AND "policyId"=:policyId;', {'policyId': 'policy-abc', 'groupId': 'group-xyz'}, 1), ] self.assertEqual(calls, self.client.execute.mock_calls)
def test_delete_policy(self): """Deletes a policy.""" def execute(*args, **kwargs): return defer.succeed(None) self.client.execute.side_effect = execute d = cass.delete_policy(self.client, 'group-xyz', 'policy-abc') self.successResultOf(d) calls = [ mock.call( 'DELETE FROM policies WHERE "groupId"=:groupId AND "policyId"=:policyId;', { 'policyId': 'policy-abc', 'groupId': 'group-xyz' }, 1), ] self.assertEqual(calls, self.client.execute.mock_calls)