def test_delete_relationship(self):
        """Test that a user can delete a relationship"""
        relationship = self.user1.link_to_acl(self.entity1, roles.Role.OWNER)

        # # assert we can get the entity
        response = client.get(
            f"/api/v2/entities/{self.entity1.id}",
            headers={"Authorization": f"Bearer {self.user1_token}"},
        )
        self.assertEqual(response.status_code, 200)

        # assert entity shows up in search
        response = client.post(
            "/api/v2/entities/search",
            json={"query": {"name": "test1"}, "type": "malware"},
            headers={"Authorization": f"Bearer {self.user1_token}"},
        )
        data = response.json()
        self.assertEqual(response.status_code, 200, data)
        self.assertEqual(data["entities"][0]["name"], "test1")

        response = client.delete(
            f"/api/v2/rbac/{relationship.id}",
            headers={"Authorization": f"Bearer {self.user1_token}"},
        )
        self.assertEqual(response.status_code, 200)

        response = client.post(
            "/api/v2/entities/search",
            json={"query": {"name": "test1"}, "type": "malware"},
            headers={"Authorization": f"Bearer {self.user1_token}"},
        )
        data = response.json()
        self.assertEqual(response.status_code, 200, data)
        self.assertEqual(data["entities"], [])

        response = client.get(
            f"/api/v2/entities/{self.entity1.id}",
            headers={"Authorization": f"Bearer {self.user1_token}"},
        )
        self.assertEqual(response.status_code, 403)
Test that a user can delete a relationship
tests/apiv2/rbac.py