File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed
services/web/server/tests/unit/with_dbs/03 Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -67,11 +67,13 @@ async def test_get_and_search_public_users(
6767 user_role : UserRole ,
6868):
6969 assert client .app
70- assert user_role == logged_user ["role" ]
70+ assert user_role . value == logged_user ["role" ]
7171 other_user = user
7272
7373 assert other_user ["id" ] != logged_user ["id" ]
7474
75+ # GET user fro admin
76+
7577 # GET user
7678 url = client .app .router ["get_user" ].url_for (user_id = f'{ other_user ["id" ]} ' )
7779 resp = await client .get (f"{ url } " )
@@ -83,15 +85,24 @@ async def test_get_and_search_public_users(
8385
8486 # SEARCH user
8587 partial_email = other_user ["email" ][:- 5 ]
86- url = client .app .router ["search_users" ].url_for (). with_query ( match = partial_email )
87- resp = await client .post (f"{ url } " )
88+ url = client .app .router ["search_users" ].url_for ()
89+ resp = await client .post (f"{ url } " , json = { "match" : partial_email } )
8890 data , _ = await assert_status (resp , status .HTTP_200_OK )
8991
9092 found = TypeAdapter (list [UserGet ]).validate_python (data )
9193 assert found
9294 assert len (found ) == 1
9395 assert found [0 ] == got
9496
97+ # SEARCH user for admin (from a USER)
98+ url = (
99+ client .app .router ["search_users_for_admin" ]
100+ .url_for ()
101+ .with_query (email = partial_email )
102+ )
103+ resp = await client .get (f"{ url } " )
104+ await assert_status (resp , status .HTTP_403_FORBIDDEN )
105+
95106
96107@pytest .mark .parametrize (
97108 "user_role,expected" ,
You can’t perform that action at this time.
0 commit comments