Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
pcrespov committed Nov 20, 2024
1 parent 3c3a2a0 commit 44e1c15
Showing 1 changed file with 19 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ async def test_workspaces_user_role_permissions(
assert client.app

url = client.app.router["list_workspaces"].url_for()
resp = await client.get(url.path)
resp = await client.get(f"{url}")
await assert_status(resp, expected.ok)


Expand All @@ -65,78 +65,75 @@ async def test_workspaces_workflow(

# list user workspaces
url = client.app.router["list_workspaces"].url_for()
resp = await client.get(url.path)
resp = await client.get(f"{url}")
data, _ = await assert_status(resp, status.HTTP_200_OK)
assert data == []

# create a new workspace
url = client.app.router["create_workspace"].url_for()
resp = await client.post(
url.path,
f"{url}",
json={
"name": "My first workspace",
"description": "Custom description",
"thumbnail": None,
},
)
added_workspace, _ = await assert_status(resp, status.HTTP_201_CREATED)
assert WorkspaceGet.parse_obj(added_workspace)
data, _ = await assert_status(resp, status.HTTP_201_CREATED)
added_workspace = WorkspaceGet.parse_obj(data)

# list user workspaces
url = client.app.router["list_workspaces"].url_for()
resp = await client.get(url.path)
resp = await client.get(f"{url}")
data, _, meta, links = await assert_status(
resp, status.HTTP_200_OK, include_meta=True, include_links=True
)
assert len(data) == 1
assert data[0]["workspaceId"] == added_workspace["workspaceId"]
assert data[0]["name"] == "My first workspace"
assert data[0]["description"] == "Custom description"
assert data[0] == added_workspace.dict()
assert meta["count"] == 1
assert links

# get a user workspace
url = client.app.router["get_workspace"].url_for(
workspace_id=f"{added_workspace['workspaceId']}"
workspace_id=f"{added_workspace.workspace_id}"
)
resp = await client.get(url)
resp = await client.get(f"{url}")
data, _ = await assert_status(resp, status.HTTP_200_OK)
assert data["workspaceId"] == added_workspace["workspaceId"]
assert data["workspaceId"] == added_workspace.workspace_id
assert data["name"] == "My first workspace"
assert data["description"] == "Custom description"

# update a workspace
url = client.app.router["replace_workspace"].url_for(
workspace_id=f"{added_workspace['workspaceId']}"
workspace_id=f"{added_workspace.workspace_id}"
)
resp = await client.put(
url.path,
f"{url}",
json={
"name": "My Second workspace",
"description": "",
},
)
data, _ = await assert_status(resp, status.HTTP_200_OK)
assert WorkspaceGet.parse_obj(data)
second_workspace = WorkspaceGet.parse_obj(data)

# list user workspaces
url = client.app.router["list_workspaces"].url_for()
resp = await client.get(url.path)
resp = await client.get(f"{url}")
data, _ = await assert_status(resp, status.HTTP_200_OK)
assert len(data) == 1
assert data[0]["name"] == "My Second workspace"
assert data[0]["description"] == ""
assert data[0] == second_workspace.dict()

# delete a workspace
url = client.app.router["delete_workspace"].url_for(
workspace_id=f"{added_workspace['workspaceId']}"
workspace_id=f"{added_workspace.workspace_id}"
)
resp = await client.delete(url.path)
resp = await client.delete(f"{url}")
data, _ = await assert_status(resp, status.HTTP_204_NO_CONTENT)

# list user workspaces
url = client.app.router["list_workspaces"].url_for()
resp = await client.get(url.path)
resp = await client.get(f"{url}")
data, _ = await assert_status(resp, status.HTTP_200_OK)
assert data == []

Expand All @@ -151,3 +148,4 @@ async def test_project_workspace_movement_full_workflow(
assert client.app

# NOTE: MD: not yet implemented
# SEE https://github.com/ITISFoundation/osparc-simcore/issues/6778

0 comments on commit 44e1c15

Please sign in to comment.