Skip to content
This repository has been archived by the owner on Jun 14, 2024. It is now read-only.

Commit

Permalink
feat: add missing test for admin from different workspace
Browse files Browse the repository at this point in the history
  • Loading branch information
jfcalvo committed May 13, 2024
1 parent c74bc32 commit cdf92d8
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/unit/api/v1/workspaces/test_delete_workspace_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,25 @@ async def test_delete_workspace_user_as_admin(self, db: AsyncSession, async_clie
assert response.status_code == 200
assert (await db.execute(select(func.count(WorkspaceUser.id)))).scalar() == 0

async def test_delete_workspace_user_as_admin_from_different_workspace(
self, db: AsyncSession, async_client: AsyncClient
):
workspace = await WorkspaceFactory.create()
user = await AdminFactory.create()
await WorkspaceUserFactory.create(workspace_id=workspace.id, user_id=user.id)

other_workspace = await WorkspaceFactory.create()
admin = await AdminFactory.create()
await WorkspaceUserFactory.create(workspace_id=other_workspace.id, user_id=admin.id)

response = await async_client.delete(
self.url(workspace.id, user.id),
headers={API_KEY_HEADER_NAME: admin.api_key},
)

assert response.status_code == 403
assert (await db.execute(select(func.count(WorkspaceUser.id)))).scalar() == 2

async def test_delete_workspace_user_as_annotator(self, db: AsyncSession, async_client: AsyncClient):
workspace = await WorkspaceFactory.create()
annotator = await AnnotatorFactory.create()
Expand Down

0 comments on commit cdf92d8

Please sign in to comment.