Skip to content

Commit cdfc0cb

Browse files
committed
create
1 parent 83b0552 commit cdfc0cb

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

api/specs/web-server/_tags.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
@router.post(
2323
"/tags",
2424
response_model=Envelope[TagGet],
25+
status_code=status.HTTP_201_CREATED,
2526
)
2627
async def create_tag(_body: TagCreate):
2728
...

services/web/server/src/simcore_service_webserver/api/v0/openapi.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -867,7 +867,7 @@ paths:
867867
$ref: '#/components/schemas/TagCreate'
868868
required: true
869869
responses:
870-
'200':
870+
'201':
871871
description: Successful Response
872872
content:
873873
application/json:

services/web/server/src/simcore_service_webserver/tags/_rest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ async def create_tag(request: web.Request):
6464
created = await _service.create_tag(
6565
request.app, user_id=req_ctx.user_id, new_tag=new_tag
6666
)
67-
return envelope_json_response(created)
67+
return envelope_json_response(created, status_cls=web.HTTPCreated)
6868

6969

7070
@routes.get(f"/{VTAG}/tags", name="list_tags")

services/web/server/tests/unit/with_dbs/03/tags/test_tags.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ async def test_tags_to_studies(
6363
]:
6464
url = client.app.router["create_tag"].url_for()
6565
resp = await client.post(f"{url}", json=tag)
66-
added_tag, _ = await assert_status(resp, status.HTTP_200_OK)
66+
added_tag, _ = await assert_status(resp, status.HTTP_201_CREATED)
6767
added_tags.append(added_tag)
6868

6969
# Add tag to study
@@ -180,7 +180,7 @@ async def test_create_and_update_tags(
180180
f"{url}",
181181
json={"name": "T", "color": "#f00"},
182182
)
183-
created, _ = await assert_status(resp, status.HTTP_200_OK)
183+
created, _ = await assert_status(resp, status.HTTP_201_CREATED)
184184

185185
assert created == {
186186
"id": created["id"],
@@ -234,7 +234,7 @@ async def test_create_tags_with_order_index(
234234
"priority": priority_index,
235235
},
236236
)
237-
created, _ = await assert_status(resp, status.HTTP_200_OK)
237+
created, _ = await assert_status(resp, status.HTTP_201_CREATED)
238238
expected_tags[priority_index] = created
239239

240240
url = client.app.router["list_tags"].url_for()
@@ -286,7 +286,7 @@ async def test_share_tags_by_creating_associated_groups(
286286
f"{url}",
287287
json={"name": "shared", "color": "#fff"},
288288
)
289-
tag, _ = await assert_status(resp, status.HTTP_200_OK)
289+
tag, _ = await assert_status(resp, status.HTTP_201_CREATED)
290290

291291
# LIST
292292
url = client.app.router["list_tag_groups"].url_for(tag_id=f"{tag['id']}")
@@ -376,7 +376,7 @@ async def test_cannot_share_tag_with_everyone(
376376
f"{url}",
377377
json={"name": "shared", "color": "#fff"},
378378
)
379-
tag, _ = await assert_status(resp, status.HTTP_200_OK)
379+
tag, _ = await assert_status(resp, status.HTTP_201_CREATED)
380380
tag_id: int = tag["id"]
381381

382382
# cannot SHARE with everyone group

services/web/server/tests/unit/with_dbs/04/workspaces/test_workspaces__list_projects_full_search.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,12 +165,11 @@ async def test_workspaces__list_projects_full_search(
165165
assert sorted_data[2]["folderId"] == root_folder["folderId"]
166166

167167

168-
@pytest.mark.parametrize("user_role,expected", [(UserRole.USER, status.HTTP_200_OK)])
168+
@pytest.mark.parametrize("user_role", [UserRole.USER])
169169
async def test__list_projects_full_search_with_query_parameters(
170170
client: TestClient,
171171
logged_user: UserInfoDict,
172172
user_project: ProjectDict,
173-
expected: HTTPStatus,
174173
mock_catalog_api_get_services_for_user_in_product: MockerFixture,
175174
fake_project: ProjectDict,
176175
workspaces_clean_db: None,
@@ -220,14 +219,14 @@ async def test__list_projects_full_search_with_query_parameters(
220219
resp = await client.post(
221220
f"{url}", json={"name": "tag1", "description": "description1", "color": "#f00"}
222221
)
223-
added_tag, _ = await assert_status(resp, expected)
222+
added_tag, _ = await assert_status(resp, status.HTTP_201_CREATED)
224223

225224
# Add tag to study
226225
url = client.app.router["add_project_tag"].url_for(
227226
project_uuid=project["uuid"], tag_id=str(added_tag.get("id"))
228227
)
229228
resp = await client.post(f"{url}")
230-
data, _ = await assert_status(resp, expected)
229+
data, _ = await assert_status(resp, status.HTTP_200_OK)
231230

232231
# Full search with tag_ids
233232
base_url = client.app.router["list_projects_full_search"].url_for()

0 commit comments

Comments
 (0)