Skip to content

Commit e692c8b

Browse files
committed
cleanup
1 parent 570dfcb commit e692c8b

File tree

2 files changed

+12
-35
lines changed

2 files changed

+12
-35
lines changed

services/web/server/src/simcore_service_webserver/users/_controller/rest/users_rest.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@
3838
_PHONE_REGISTRATION_KEY = "phone_registration"
3939
_PHONE_PENDING_KEY = "phone_pending"
4040
_PHONE_CODE_KEY = "phone_code"
41-
_PHONE_CODE_VALUE_FAKE = "123456"
41+
_PHONE_CODE_VALUE_FAKE = (
42+
"123456" # NOTE: temporary fake while developing phone registration feature
43+
)
4244

4345
routes = web.RouteTableDef()
4446

services/web/server/tests/unit/with_dbs/03/test_users_rest_profiles.py

Lines changed: 9 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@
3636
from simcore_service_webserver.user_preferences._service import (
3737
get_frontend_user_preferences_aggregation,
3838
)
39+
from simcore_service_webserver.users._controller.rest.users_rest import (
40+
_PHONE_CODE_VALUE_FAKE,
41+
)
3942
from sqlalchemy.exc import OperationalError as SQLAlchemyOperationalError
4043
from sqlalchemy.ext.asyncio import AsyncConnection
4144

@@ -50,6 +53,7 @@ def app_environment(
5053
{
5154
"WEBSERVER_GARBAGE_COLLECTOR": "null",
5255
"WEBSERVER_DB_LISTENER": "0",
56+
"WEBSERVER_DEV_FEATURES_ENABLED": "1", # NOTE: still under development
5357
},
5458
)
5559

@@ -626,7 +630,7 @@ async def test_phone_registration_basic_workflow(
626630
resp = await client.post(
627631
f"{url}",
628632
json={
629-
"code": "123456",
633+
"code": _PHONE_CODE_VALUE_FAKE,
630634
},
631635
)
632636
await assert_status(resp, status.HTTP_204_NO_CONTENT)
@@ -682,7 +686,7 @@ async def test_phone_registration_workflow(
682686
resp = await client.post(
683687
f"{url}",
684688
json={
685-
"code": "123456",
689+
"code": _PHONE_CODE_VALUE_FAKE,
686690
},
687691
)
688692
await assert_status(resp, status.HTTP_204_NO_CONTENT)
@@ -735,7 +739,7 @@ async def test_phone_registration_with_resend(
735739
resp = await client.post(
736740
f"{url}",
737741
json={
738-
"code": "123456",
742+
"code": _PHONE_CODE_VALUE_FAKE,
739743
},
740744
)
741745
await assert_status(resp, status.HTTP_204_NO_CONTENT)
@@ -775,7 +779,7 @@ async def test_phone_registration_change_existing_phone(
775779
resp = await client.post(
776780
f"{url}",
777781
json={
778-
"code": "123456",
782+
"code": _PHONE_CODE_VALUE_FAKE,
779783
},
780784
)
781785
await assert_status(resp, status.HTTP_204_NO_CONTENT)
@@ -795,36 +799,7 @@ async def test_phone_registration_change_existing_phone(
795799
resp = await client.post(
796800
f"{url}",
797801
json={
798-
"code": "123456",
799-
},
800-
)
801-
await assert_status(resp, status.HTTP_204_NO_CONTENT)
802-
803-
# GET updated profile
804-
url = client.app.router["get_my_profile"].url_for()
805-
resp = await client.get(f"{url}")
806-
data, _ = await assert_status(resp, status.HTTP_200_OK)
807-
808-
updated_profile = MyProfileRestGet.model_validate(data)
809-
810-
# Verify phone was updated to new phone
811-
assert updated_profile.phone == new_phone
812-
assert updated_profile.phone != first_phone
813-
new_phone = faker.phone_number()
814-
url = client.app.router["register_my_phone_init"].url_for()
815-
resp = await client.post(
816-
f"{url}",
817-
json={
818-
"phone": new_phone,
819-
},
820-
)
821-
await assert_status(resp, status.HTTP_202_ACCEPTED)
822-
823-
url = client.app.router["register_my_phone_confirm"].url_for()
824-
resp = await client.post(
825-
f"{url}",
826-
json={
827-
"code": "123456",
802+
"code": _PHONE_CODE_VALUE_FAKE,
828803
},
829804
)
830805
await assert_status(resp, status.HTTP_204_NO_CONTENT)

0 commit comments

Comments
 (0)