Coverage for tests/endpoints/tests_invites.py: 100%
11 statements
« prev ^ index » next coverage.py v7.10.2, created at 2025-08-05 22:06 +0000
« prev ^ index » next coverage.py v7.10.2, created at 2025-08-05 22:06 +0000
1from unittest.mock import patch
3from tests.endpoints.endpoint_testing import TestEndpoints
6class TestInvites(TestEndpoints):
7 @patch("canonicalwebteam.store_api.dashboard.Dashboard.get_store_invites")
8 def test_get_invites(self, mock_get_store_invites):
9 mock_invites_data = [
10 {
11 "id": "invite-1",
12 "email": "user1@example.com",
13 "status": "pending",
14 "roles": ["admin"],
15 "created_at": "2025-01-01T10:00:00Z",
16 },
17 {
18 "id": "invite-2",
19 "email": "user2@example.com",
20 "status": "accepted",
21 "roles": ["view"],
22 "created_at": "2025-01-02T11:00:00Z",
23 },
24 ]
26 mock_get_store_invites.return_value = mock_invites_data
28 response = self.client.get("/api/store/test-store-id/invites")
29 data = response.get_json()
31 self.assertEqual(response.status_code, 200)
32 self.assertEqual(data, mock_invites_data)