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

        payload = {
            "type": "generic",
            "value": "test",
        }

        response = client.post(
            "/api/v2/observables",
            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/observables",
            json=payload,
            headers={"Authorization": f"Bearer {self.user1_token}"},
        )
        self.assertEqual(response.status_code, 200)
Test that a user can create a new observable
tests/apiv2/rbac.py