def test_global_writer_indicator(self):
        """Test that a user can create a new indicator"""
        self.user1.global_role = roles.Role.READER
        self.user1.save()

        payload = {
            "indicator": {
                "pattern": "test",
                "type": "regex",
                "name": "test",
                "diamond": "victim",
            }
        }
        response = client.post(
            "/api/v2/indicators",
            json=payload,
            headers={"Authorization": f"Bearer {self.user1_token}"},
        )
        data = response.json()
        self.assertEqual(response.status_code, 403, data)

        self.user1.global_role = roles.Role.WRITER
        self.user1.save()

        response = client.post(
            "/api/v2/indicators",
            json=payload,
            headers={"Authorization": f"Bearer {self.user1_token}"},
        )
        self.assertEqual(response.status_code, 200)
Test that a user can create a new indicator
tests/apiv2/rbac.py