File tree Expand file tree Collapse file tree 1 file changed +5
-11
lines changed
services/web/server/tests/unit/with_dbs/01 Expand file tree Collapse file tree 1 file changed +5
-11
lines changed Original file line number Diff line number Diff line change 1818from pytest_simcore .helpers .webserver_login import NewUser , UserInfoDict
1919from servicelib .aiohttp import status
2020from simcore_service_webserver .api_keys ._api import (
21- get_api_key ,
2221 get_or_create_api_key ,
2322 prune_expired_api_keys ,
2423)
@@ -184,31 +183,26 @@ async def test_get_or_create_api_key(
184183 assert client .app
185184
186185 options = {
186+ "name" : "foo" ,
187187 "user_id" : user ["id" ],
188188 "product_name" : "osparc" ,
189189 }
190190
191- # does not exist
192- assert await get_api_key (client .app , ** options | {"api_key_id" : 1 }) is None
193-
194191 # create once
195- created = await get_or_create_api_key (client .app , ** options | { "name" : "foo" } )
192+ created = await get_or_create_api_key (client .app , ** options )
196193 assert created .display_name == "foo"
197194 assert created .api_key != created .api_secret
198195
199- # idempottent
196+ # idempotent
200197 for _ in range (3 ):
201- assert (
202- await get_or_create_api_key (client .app , ** options | {"name" : "foo" })
203- == created
204- )
198+ assert await get_or_create_api_key (client .app , ** options ) == created
205199
206200
207201@pytest .mark .parametrize (
208202 "user_role,expected" ,
209203 _get_user_access_parametrizations (status .HTTP_404_NOT_FOUND ),
210204)
211- async def test_api_key_does_not_exists (
205+ async def test_get_not_existing_api_key (
212206 client : TestClient ,
213207 logged_user : UserInfoDict ,
214208 user_role : UserRole ,
You can’t perform that action at this time.
0 commit comments