test(api): adjust user search tests expectation

This commit is contained in:
Saw-jan
2024-04-03 13:06:45 +05:45
parent 59fab4ae5a
commit 43abf34be8
2 changed files with 52 additions and 61 deletions

View File

@@ -15,8 +15,9 @@ Feature: edit user
| email | brian@example.com |
| password | 1234 |
@env-config
Scenario Outline: admin user can edit another user's email
Given the config "OCIS_SHOW_USER_EMAIL_IN_RESULTS" has been set to "true"
When the user "Alice" changes the email of user "Brian" to "<new-email>" using the Graph API
Then the HTTP status code should be "<http-status-code>"
And the user information of "Brian" should match this JSON schema
@@ -120,9 +121,10 @@ Feature: edit user
}
"""
@env-config
Scenario Outline: normal user should not be able to change their email address
Given the administrator has assigned the role "<user-role>" to user "Brian" using the Graph API
And the config "OCIS_SHOW_USER_EMAIL_IN_RESULTS" has been set to "true"
When the user "Brian" tries to change the email of user "Brian" to "newemail@example.com" using the Graph API
Then the HTTP status code should be "401"
And the user information of "Brian" should match this JSON schema
@@ -146,9 +148,10 @@ Feature: edit user
| User |
| User Light |
@env-config
Scenario Outline: normal user should not be able to edit another user's email
Given the administrator has assigned the role "<user-role>" to user "Brian" using the Graph API
And the config "OCIS_SHOW_USER_EMAIL_IN_RESULTS" has been set to "true"
And the user "Alice" has created a new user with the following attributes:
| userName | Carol |
| displayName | Carol King |
@@ -329,7 +332,6 @@ Feature: edit user
"required": [
"displayName",
"id",
"mail",
"onPremisesSamAccountName",
"accountEnabled"
],
@@ -342,10 +344,6 @@ Feature: edit user
"type": "string",
"pattern": "^%user_id_pattern%$"
},
"mail": {
"type": "string",
"enum": ["brian@example.com"]
},
"onPremisesSamAccountName": {
"type": "string",
"enum": ["Brian"]
@@ -373,7 +371,6 @@ Feature: edit user
"required": [
"displayName",
"id",
"mail",
"onPremisesSamAccountName",
"accountEnabled"
],
@@ -386,10 +383,6 @@ Feature: edit user
"type": "string",
"pattern": "^%user_id_pattern%$"
},
"mail": {
"type": "string",
"enum": ["carol@example.org"]
},
"onPremisesSamAccountName": {
"type": "string",
"enum": ["Carol"]
@@ -421,7 +414,6 @@ Feature: edit user
"required": [
"displayName",
"id",
"mail",
"onPremisesSamAccountName",
"accountEnabled"
],
@@ -434,10 +426,6 @@ Feature: edit user
"type": "string",
"pattern": "^%user_id_pattern%$"
},
"mail": {
"type": "string",
"enum": ["brian@example.com"]
},
"onPremisesSamAccountName": {
"type": "string",
"enum": ["Brian"]
@@ -466,7 +454,6 @@ Feature: edit user
"required": [
"displayName",
"id",
"mail",
"onPremisesSamAccountName",
"accountEnabled"
],
@@ -479,10 +466,6 @@ Feature: edit user
"type": "string",
"pattern": "^%user_id_pattern%$"
},
"mail": {
"type": "string",
"enum": ["carol@example.org"]
},
"onPremisesSamAccountName": {
"type": "string",
"enum": ["Carol"]

View File

@@ -298,7 +298,6 @@ Feature: get users
"required": [
"displayName",
"id",
"mail",
"onPremisesSamAccountName",
"drive",
"accountEnabled",
@@ -313,10 +312,6 @@ Feature: get users
"type": "string",
"pattern": "^%user_id_pattern%$"
},
"mail": {
"type": "string",
"enum": ["brian@example.org"]
},
"onPremisesSamAccountName": {
"type": "string",
"enum": ["Brian"]
@@ -428,7 +423,6 @@ Feature: get users
"required": [
"displayName",
"id",
"mail",
"onPremisesSamAccountName",
"drive",
"accountEnabled",
@@ -443,10 +437,6 @@ Feature: get users
"type": "string",
"pattern": "^%user_id_pattern%$"
},
"mail": {
"type": "string",
"enum": ["brian@example.org"]
},
"onPremisesSamAccountName": {
"type": "string",
"enum": ["Brian"]
@@ -567,7 +557,6 @@ Feature: get users
"type": "object",
"required": [
"id",
"mail",
"onPremisesSamAccountName"
],
"properties": {
@@ -575,10 +564,6 @@ Feature: get users
"type": "string",
"pattern": "^%user_id_pattern%$"
},
"mail": {
"type": "string",
"enum": ["brian@example.org"]
},
"onPremisesSamAccountName": {
"type": "string",
"enum": ["Brian"]
@@ -1352,6 +1337,50 @@ Feature: get users
Scenario: non-admin user searches other users by display name
When user "Brian" searches for user "ali" 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": {
"type": "string",
"enum": ["Alice Hansen"]
},
"id": {
"type": "string",
"pattern": "^%user_id_pattern%$"
},
"userType": {
"type": "string",
"enum": ["Member"]
}
}
}
}
}
}
"""
@env-config
Scenario: non-admin user searches other users by display name (OCIS_SHOW_USER_EMAIL_IN_RESULTS enabled)
Given the config "OCIS_SHOW_USER_EMAIL_IN_RESULTS" has been set to "true"
When user "Brian" searches for user "ali" using Graph API
Then the HTTP status code should be "200"
And the JSON data of the response should match
@@ -1480,7 +1509,6 @@ Feature: get users
"required": [
"displayName",
"id",
"mail",
"userType"
],
"properties": {
@@ -1492,10 +1520,6 @@ Feature: get users
"type": "string",
"pattern": "^%user_id_pattern%$"
},
"mail": {
"type": "string",
"enum": ["alice@example.org"]
},
"userType": {
"type": "string",
"enum": ["Member"]
@@ -1529,7 +1553,6 @@ Feature: get users
"required": [
"displayName",
"id",
"mail",
"userType"
],
"properties": {
@@ -1541,10 +1564,6 @@ Feature: get users
"type": "string",
"pattern": "^%user_id_pattern%$"
},
"mail": {
"type": "string",
"enum": ["alice@example.org"]
},
"userType": {
"type": "string",
"enum": ["Member"]
@@ -1560,10 +1579,9 @@ Feature: get users
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 |
| displayName | Alice Murphy |
| 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
@@ -1586,7 +1604,6 @@ Feature: get users
"required": [
"displayName",
"id",
"mail",
"userType"
],
"properties": {
@@ -1598,10 +1615,6 @@ Feature: get users
"type": "string",
"pattern": "^%user_id_pattern%$"
},
"mail": {
"type": "string",
"enum": ["alice@example.org"]
},
"userType": {
"type": "string",
"enum": ["Member"]
@@ -1613,22 +1626,17 @@ Feature: get users
"required": [
"displayName",
"id",
"mail",
"userType"
],
"properties": {
"displayName": {
"type": "string",
"enum": ["Alice Hansen"]
"enum": ["Alice Murphy"]
},
"id": {
"type": "string",
"pattern": "^%user_id_pattern%$"
},
"mail": {
"type": "string",
"enum": ["another-alice@example.org"]
},
"userType": {
"type": "string",
"enum": ["Member"]