Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tests-only] add API tests to search user/group with special chars #9015

Merged
merged 1 commit into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 47 additions & 2 deletions tests/acceptance/features/apiGraphUserGroup/getGroup.feature
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ Feature: get groups and their members
Then the HTTP status code should be "404"


Scenario Outline: non-admin user search for a group by group name
Scenario Outline: non-admin user searches for a group by group name
Given these users have been created with default attributes and without skeleton files:
| username |
| Brian |
Expand Down Expand Up @@ -546,7 +546,7 @@ Feature: get groups and their members
"""

@issue-7990
Scenario Outline: non-admin user tries to search for a group by group name with invalid characters/token
Scenario Outline: user tries to search for groups with invalid characters/token (search term without quotation)
Given these users have been created with default attributes and without skeleton files:
| username |
| Brian |
Expand Down Expand Up @@ -580,3 +580,48 @@ Feature: get groups and their members
| group | token |
| tea-lovers | -lovers |
| tea@lovers | @lovers |

@issue-7990
Scenario Outline: user searches for groups with special characters (search term with quotation)
Given these users have been created with default attributes and without skeleton files:
| username |
| Brian |
And group "<group>" has been created
When user "Brian" tries to search for group '"<group>"' 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",
"maxItems": 1,
"minItems": 1,
"items": {
"type": "object",
"required": ["displayName", "id", "groupTypes"],
"properties": {
"displayName": {
"const": "<group>"
},
"id": {
"type": "string",
"pattern": "%group_id_pattern%"
},
"groupTypes": {
"const": []
}
}
}
}
}
}
"""
Examples:
| group | token |
| tea-lovers | -lovers |
| tea@lovers | @lovers |
| -_.ocgrp | -_. |
| _ocgrp@ | _oc |
68 changes: 66 additions & 2 deletions tests/acceptance/features/apiGraphUserGroup/getUser.feature
Original file line number Diff line number Diff line change
Expand Up @@ -1402,7 +1402,7 @@ Feature: get users
"""

@issue-7990
Scenario Outline: non-admin user tries to search for a user by display name with invalid characters/token
Scenario Outline: user tries to search other users with invalid characters/token (search term without quotation)
Given user "<user>" has been created with default attributes and without skeleton files
When user "Brian" tries to search for user "<user>" using Graph API
Then the HTTP status code should be "400"
Expand Down Expand Up @@ -1435,7 +1435,7 @@ Feature: get users
| Alice@From@Wonderland | @From@Wonderland |

@issue-7990
Scenario: non-admin user searches other users by e-mail
Scenario: non-admin user searches other users by e-mail (search term with quotation)
When user "Brian" searches for user "%[email protected]%22" using Graph API
Then the HTTP status code should be "200"
And the JSON data of the search response should not contain user email
Expand Down Expand Up @@ -1601,3 +1601,67 @@ Feature: get users
}
}
"""


Scenario: user searches for a non-existent user/group
When user "Brian" tries to search for user "nonexistent" 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",
"minItems": 0,
"maxItems": 0
}
}
}
"""

@issue-7990
Scenario Outline: user searches for other users having special characters in displayname (search term with quotation)
Given the user "Admin" has created a new user with the following attributes:
| userName | specail-user |
| displayName | <displayname> |
| email | [email protected] |
When user "Brian" searches for user '"<search-term>"' 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",
"minItems": 1,
"maxItems": 1,
"items": {
"type": "object",
"required": ["displayName", "id", "userType"],
"properties": {
"displayName": {
"const": "<displayname>"
},
"id": {
"type": "string",
"pattern": "^%user_id_pattern%$"
},
"userType": {
"const": "Member"
}
}
}
}
}
}
"""
Examples:
| displayname | search-term |
| -_.ocusr | -_. |
| _ocusr@ | _oc |
| Alice-Wonderland | -Wonderland |
| Alice@Wonderland | @Wonderland |