Skip to content

Commit 6eb5898

Browse files
committed
updates tests
1 parent 8b13393 commit 6eb5898

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

services/api-server/src/simcore_service_api_server/services/webserver.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,14 +266,15 @@ async def get_me(self) -> Profile:
266266
@_exception_mapper(_PROFILE_STATUS_MAP)
267267
async def update_me(self, *, profile_update: ProfileUpdate) -> Profile:
268268

269-
update = WebProfileUpdate(
269+
update = WebProfileUpdate.model_construct(
270+
_fields_set=profile_update.model_fields_set,
270271
first_name=profile_update.first_name,
271272
last_name=profile_update.last_name,
272273
)
273274

274275
response = await self.client.patch(
275276
"/me",
276-
json=update.model_dump(exclude_none=True, exclude_unset=True),
277+
json=update.model_dump(exclude_unset=True),
277278
cookies=self.session_cookies,
278279
)
279280
response.raise_for_status()

services/api-server/tests/unit/_with_db/test_api_user.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ def mocked_webserver_service_api(app: FastAPI):
3232
) as respx_mock:
3333
# NOTE: webserver-api uses the same schema as api-server!
3434
# in-memory fake data
35-
me = WebProfileGet.model_json_schema()["examples"][0]
35+
me: dict = WebProfileGet.model_json_schema()["examples"][0]
36+
me["first_name"] = "James"
37+
me["last_name"] = "Maxwell"
3638

3739
def _get_me(request):
3840
return httpx.Response(status.HTTP_200_OK, json={"data": me})
@@ -43,12 +45,10 @@ def _update_me(request: httpx.Request):
4345
return httpx.Response(status.HTTP_200_OK, json={"data": me})
4446

4547
respx_mock.get("/me", name="get_me").mock(side_effect=_get_me)
46-
respx_mock.put("/me", name="update_me").mock(side_effect=_update_me)
48+
respx_mock.patch("/me", name="update_me").mock(side_effect=_update_me)
4749

4850
yield respx_mock
4951

50-
del me
51-
5252

5353
async def test_get_profile(
5454
client: httpx.AsyncClient,

0 commit comments

Comments
 (0)