From 7d6cdd649effde60da5f8922ce5efa81ccea65b6 Mon Sep 17 00:00:00 2001 From: nirajacharya2 <122071597+nirajacharya2@users.noreply.github.com> Date: Wed, 24 Jan 2024 09:57:38 +0545 Subject: [PATCH] added tests for searching users by normal user (#8241) --- .../apiGraphUserGroup/getUser.feature | 168 ++++++++++++++++++ 1 file changed, 168 insertions(+) diff --git a/tests/acceptance/features/apiGraphUserGroup/getUser.feature b/tests/acceptance/features/apiGraphUserGroup/getUser.feature index 925435885..dced64670 100644 --- a/tests/acceptance/features/apiGraphUserGroup/getUser.feature +++ b/tests/acceptance/features/apiGraphUserGroup/getUser.feature @@ -1443,3 +1443,171 @@ Feature: get users | user | errorToken | | Alice-From-Wonderland | -From-Wonderland | | Alice@From@Wonderland | @From@Wonderland | + + @issue-7990 + Scenario: non-admin user searches other users by e-mail + When user "Brian" searches for user "%22alice@example.org%22" using Graph API + Then the HTTP status code should be "200" + And the JSON data of the response should match + """ + { + "type": "object", + "required": [ + "value" + ], + "properties": { + "value": { + "type": "array", + "required": [ + "displayName", + "id", + "mail", + "userType" + ], + "properties": { + "displayName": { + "type": "string", + "enum": ["Alice Hansen"] + }, + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + }, + "mail": { + "type": "string", + "enum": ["alice@example.org"] + }, + "userType": { + "type": "string", + "enum": ["Member"] + } + } + } + } + } + """ + + + Scenario: non-admin user searches for a disabled users + Given the user "Admin" has disabled user "Alice" + When user "Brian" searches for user "alice" using Graph API + Then the HTTP status code should be "200" + And the JSON data of the response should match + """ + { + "type": "object", + "required": [ + "value" + ], + "properties": { + "value": { + "type": "array", + "required": [ + "displayName", + "id", + "mail", + "userType" + ], + "properties": { + "displayName": { + "type": "string", + "enum": ["Alice Hansen"] + }, + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + }, + "mail": { + "type": "string", + "enum": ["alice@example.org"] + }, + "userType": { + "type": "string", + "enum": ["Member"] + } + } + } + } + } + """ + + + Scenario: non-admin user searches for multiple users having same displayname + Given the user "Admin" has created a new user with the following attributes: + | userName | another-alice | + | displayName | Alice Hansen | + | email | another-alice@example.org | + | password | containsCharacters(*:!;_+-&) | + + When user "Brian" searches for user "alice" using Graph API + Then the HTTP status code should be "200" + And the JSON data of the response should match + """ + { + "type": "object", + "required": [ + "value" + ], + "properties": { + "value": { + "type": "array", + "items": [ + { + "type": "object", + "required": [ + "displayName", + "id", + "mail", + "userType" + ], + "properties": { + "displayName": { + "type": "string", + "enum": ["Alice Hansen"] + }, + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + }, + "mail": { + "type": "string", + "enum": ["alice@example.org"] + }, + "userType": { + "type": "string", + "enum": ["Member"] + } + } + }, + { + "type": "object", + "required": [ + "displayName", + "id", + "mail", + "userType" + ], + "properties": { + "displayName": { + "type": "string", + "enum": ["Alice Hansen"] + }, + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + }, + "mail": { + "type": "string", + "enum": ["another-alice@example.org"] + }, + "userType": { + "type": "string", + "enum": ["Member"] + } + } + } + ] + } + } + } + """