From bace415f41186611d9651f2719b8065df3c4a625 Mon Sep 17 00:00:00 2001 From: Niraj Acharya Date: Wed, 23 Apr 2025 15:54:10 +0545 Subject: [PATCH] adding test for using auth-app token generated via impersonation api --- .../features/apiAuthApp/tokenUsage.feature | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/tests/acceptance/features/apiAuthApp/tokenUsage.feature b/tests/acceptance/features/apiAuthApp/tokenUsage.feature index 05d53cde7f7..13a515ec7f3 100644 --- a/tests/acceptance/features/apiAuthApp/tokenUsage.feature +++ b/tests/acceptance/features/apiAuthApp/tokenUsage.feature @@ -141,3 +141,56 @@ Feature: create auth-app token And user "Alice" has waited "2" second for auth-app token to expire When user "Alice" lists all available spaces via the Graph API Then the HTTP status code should be "401" + + @env-config + Scenario: user tries to use expired impersonation token created via impersonation token + Given the config "AUTH_APP_ENABLE_IMPERSONATION" has been set to "true" + And user "Admin" has created auth-app token for user "Alice" with expiration time "1s" using the auth-app API + And user "Alice" has waited "2" second for auth-app token to expire + When user "Alice" lists all available spaces via the Graph API + Then the HTTP status code should be "401" + + @env-config + Scenario: user lists their drives using impersonation token + Given the config "AUTH_APP_ENABLE_IMPERSONATION" has been set to "true" + And user "Admin" has created auth-app token for user "Alice" with expiration time "72h" using the auth-app API + When user "Alice" lists all available spaces via the Graph API + Then the HTTP status code should be "200" + And the JSON response should contain space called "Alice Hansen" and match + """ + { + "type": "object", + "required": [ + "driveType", + "driveAlias", + "name", + "id", + "quota", + "root", + "webUrl" + ], + "properties": { + "name": { "const": "Alice Hansen" }, + "driveType": { "const": "personal" }, + "driveAlias": { "const": "personal/alice" }, + "id": { "pattern": "%space_id_pattern%" }, + "quota": { + "type": "object", + "required": ["state"], + "properties": { + "state": { "const": "normal" } + } + }, + "root": { + "type": "object", + "required": ["webDavUrl"], + "properties": { + "webDavUrl": { "const": "%base_url%/dav/spaces/%space_id%" } + } + }, + "webUrl": { + "const": "%base_url%/f/%space_id%" + } + } + } + """