File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Keboola \Test \Common ;
4+
5+ use Keboola \StorageApi \Workspaces ;
6+ use Keboola \Test \Backend \Workspaces \ParallelWorkspacesTestCase ;
7+
8+ class WorkspaceDetailTest extends ParallelWorkspacesTestCase
9+ {
10+
11+ public function testReadOnlyUserCanGetWorkspaceDetail (): void
12+ {
13+ // Create workspace as normal user
14+ $ workspaces = new Workspaces ($ this ->_client );
15+ $ workspace = $ this ->initTestWorkspace ();
16+
17+ // Create a client with a read-only token
18+ $ readOnlyClient = $ this ->getReadOnlyStorageApiClient (); // Implement this helper to get a read-only token
19+ $ readOnlyWorkspaces = new Workspaces ($ readOnlyClient );
20+
21+ // Try to get workspace detail
22+ $ readOnlyWorkspaces ->listWorkspaces ();
23+ $ workspaceDetail = $ readOnlyWorkspaces ->getWorkspace ($ workspace ['id ' ]);
24+
25+ // Assert that workspace detail is returned and does not contain sensitive info
26+ $ this ->assertArrayHasKey ('id ' , $ workspaceDetail );
27+ $ this ->assertEquals ($ workspace ['id ' ], $ workspaceDetail ['id ' ]);
28+ $ this ->assertArrayNotHasKey ('password ' , $ workspaceDetail ['connection ' ]);
29+
30+ // Cleanup
31+ $ workspaces ->deleteWorkspace ($ workspace ['id ' ], [], true );
32+ }
33+ }
You can’t perform that action at this time.
0 commit comments