[tests-only][full-ci]Json assertion apigraph master branch (#5989)

* Json assertion for api graph suite

* Review Address
This commit is contained in:
Sagar Gurung
2023-04-05 14:05:34 +05:45
committed by GitHub
parent adfbddf419
commit b52597d6d1
9 changed files with 1614 additions and 426 deletions
@@ -17,9 +17,21 @@ Feature: edit user
Scenario Outline: the admin user can edit another user's email
When the user "Alice" changes the email of user "Brian" to "<newEmail>" using the Graph API
Then the HTTP status code should be "<code>"
And the user "Brian" should have information with these key and value pairs:
| key | value |
| mail | <emailAsResult> |
And the user information of "Brian" should match this JSON schema
"""
{
"type": "object",
"required": [
"mail"
],
"properties": {
"mail": {
"type": "string",
"enum": ["<emailAsResult>"]
}
}
}
"""
Examples:
| action description | newEmail | code | emailAsResult |
| change to a valid email | newemail@example.com | 200 | newemail@example.com |
@@ -33,15 +45,27 @@ Feature: edit user
Given user "Carol" has been created with default attributes and without skeleton files
When the user "Alice" changes the user name of user "Carol" to "<userName>" using the Graph API
Then the HTTP status code should be "<code>"
And the user "<userNameAsResult>" should have information with these key and value pairs:
| key | value |
| onPremisesSamAccountName | <userNameAsResult> |
And the user information of "<newUserName>" should match this JSON schema
"""
{
"type": "object",
"required": [
"onPremisesSamAccountName"
],
"properties": {
"type": "string",
"onPremisesSamAccountName": {
"enum": ["<newUserName>"]
}
}
}
"""
Examples:
| action description | userName | code | userNameAsResult |
| change to a valid user name | Lionel | 200 | Lionel |
| user name characters | *:!;_+-& | 200 | *:!;_+-& |
| change to existing user name | Brian | 409 | Brian |
| empty user name | | 200 | Brian |
| action description | userName | code | newUserName |
| change to a valid user name | Lionel | 200 | Lionel |
| user name characters | *:!;_+-& | 200 | *:!;_+-& |
| change to existing user name | Brian | 409 | Brian |
| empty user name | | 200 | Brian |
@skipOnStable2.0
Scenario: the admin user changes the name of a user to the name of an existing disabled user
@@ -53,9 +77,21 @@ Feature: edit user
And the user "Alice" has disabled user "Brian" using the Graph API
When the user "Alice" changes the user name of user "sam" to "Brian" using the Graph API
Then the HTTP status code should be "409"
And the user "sam" should have information with these key and value pairs:
| key | value |
| onPremisesSamAccountName | sam |
And the user information of "sam" should match this JSON schema
"""
{
"type": "object",
"required": [
"onPremisesSamAccountName"
],
"properties": {
"onPremisesSamAccountName": {
"type": "string",
"enum": ["sam"]
}
}
}
"""
@skipOnStable2.0
Scenario: the admin user changes the name of a user to the name of a previously deleted user
@@ -67,18 +103,42 @@ Feature: edit user
And the user "Alice" has deleted a user "sam" using the Graph API
When the user "Alice" changes the user name of user "Brian" to "sam" using the Graph API
Then the HTTP status code should be "200"
And the user "sam" should have information with these key and value pairs:
| key | value |
| onPremisesSamAccountName | sam |
And the user information of "sam" should match this JSON schema
"""
{
"type": "object",
"required": [
"onPremisesSamAccountName"
],
"properties": {
"onPremisesSamAccountName": {
"type": "string",
"enum": ["sam"]
}
}
}
"""
Scenario Outline: a normal user should not be able to change their email address
Given the administrator has given "Brian" the role "<role>" using the settings api
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 "Brian" should have information with these key and value pairs:
| key | value |
| mail | brian@example.com |
And the user information of "Brian" should match this JSON schema
"""
{
"type": "object",
"required": [
"mail"
],
"properties": {
"mail": {
"type": "string",
"enum": ["brian@example.com"]
}
}
}
"""
Examples:
| role |
| Space Admin |
@@ -96,9 +156,21 @@ Feature: edit user
And the administrator has given "Carol" the role "<role>" using the settings api
When the user "Brian" tries to change the email of user "Carol" to "newemail@example.com" using the Graph API
Then the HTTP status code should be "401"
And the user "Carol" should have information with these key and value pairs:
| key | value |
| mail | carol@example.com |
And the user information of "Carol" should match this JSON schema
"""
{
"type": "object",
"required": [
"mail"
],
"properties": {
"mail": {
"type": "string",
"enum": ["carol@example.com"]
}
}
}
"""
Examples:
| userRole | role |
| Space Admin | Space Admin |
@@ -118,9 +190,21 @@ Feature: edit user
Scenario Outline: the admin user can edit another user display name
When the user "Alice" changes the display name of user "Brian" to "<newDisplayName>" using the Graph API
Then the HTTP status code should be "200"
And the user "Brian" should have information with these key and value pairs:
| key | value |
| displayName | <displayNameAsResult> |
And the user information of "Brian" should match this JSON schema
"""
{
"type": "object",
"required": [
"displayName"
],
"properties": {
"displayName": {
"type": "string",
"enum": ["<displayNameAsResult>"]
}
}
}
"""
Examples:
| action description | newDisplayName | code | displayNameAsResult |
| change to a display name | Olaf Scholz | 200 | Olaf Scholz |
@@ -133,9 +217,21 @@ Feature: edit user
Given the administrator has given "Brian" the role "<role>" using the settings api
When the user "Brian" tries to change the display name of user "Brian" to "Brian Murphy" using the Graph API
Then the HTTP status code should be "401"
And the user "Alice" should have information with these key and value pairs:
| key | value |
| displayName | Alice Hansen |
And the user information of "Alice" should match this JSON schema
"""
{
"type": "object",
"required": [
"displayName"
],
"properties": {
"displayName": {
"type": "string",
"enum": ["Alice Hansen"]
}
}
}
"""
Examples:
| role |
| Space Admin |
@@ -153,9 +249,21 @@ Feature: edit user
And the administrator has given "Carol" the role "<role>" using the settings api
When the user "Brian" tries to change the display name of user "Carol" to "Alice Hansen" using the Graph API
Then the HTTP status code should be "401"
And the user "Carol" should have information with these key and value pairs:
| key | value |
| displayName | Carol King |
And the user information of "Carol" should match this JSON schema
"""
{
"type": "object",
"required": [
"displayName"
],
"properties": {
"displayName": {
"type": "string",
"enum": ["Carol King"]
}
}
}
"""
Examples:
| userRole | role |
| Space Admin | Space Admin |
@@ -213,9 +321,41 @@ Feature: edit user
Then the HTTP status code should be "200"
When user "Alice" gets information of user "Brian" using Graph API
Then the HTTP status code should be "200"
And the user retrieve API response should contain the following information:
| displayName | id | mail | onPremisesSamAccountName | accountEnabled |
| Brian Murphy | %uuid_v4% | brian@example.com | Brian | false |
And the JSON data of the response should match
"""
{
"type": "object",
"required": [
"displayName",
"id",
"mail",
"onPremisesSamAccountName",
"accountEnabled"
],
"properties": {
"displayName": {
"type": "string",
"enum": ["Brian Murphy"]
},
"id" : {
"type": "string",
"pattern": "^%user_id_pattern%$"
},
"mail": {
"type": "string",
"enum": ["brian@example.com"]
},
"onPremisesSamAccountName": {
"type": "string",
"enum": ["Brian"]
},
"accountEnabled": {
"type": "boolean",
"enum": [false]
}
}
}
"""
@skipOnStable2.0
Scenario Outline: a normal user should not be able to disable another user
@@ -225,9 +365,41 @@ Feature: edit user
Then the HTTP status code should be "401"
When user "Alice" gets information of user "Carol" using Graph API
Then the HTTP status code should be "200"
And the user retrieve API response should contain the following information:
| displayName | id | mail | onPremisesSamAccountName | accountEnabled |
| Carol King | %uuid_v4% | carol@example.org | Carol | true |
And the JSON data of the response should match
"""
{
"type": "object",
"required": [
"displayName",
"id",
"mail",
"onPremisesSamAccountName",
"accountEnabled"
],
"properties": {
"displayName": {
"type": "string",
"enum": ["Carol King"]
},
"id" : {
"type": "string",
"pattern": "^%user_id_pattern%$"
},
"mail": {
"type": "string",
"enum": ["carol@example.org"]
},
"onPremisesSamAccountName": {
"type": "string",
"enum": ["Carol"]
},
"accountEnabled": {
"type": "boolean",
"enum": [true]
}
}
}
"""
Examples:
| role |
| Space Admin |
@@ -241,9 +413,41 @@ Feature: edit user
Then the HTTP status code should be "200"
When user "Alice" gets information of user "Brian" using Graph API
Then the HTTP status code should be "200"
And the user retrieve API response should contain the following information:
| displayName | id | mail | onPremisesSamAccountName | accountEnabled |
| Brian Murphy | %uuid_v4% | brian@example.com | Brian | true |
And the JSON data of the response should match
"""
{
"type": "object",
"required": [
"displayName",
"id",
"mail",
"onPremisesSamAccountName",
"accountEnabled"
],
"properties": {
"displayName": {
"type": "string",
"enum": ["Brian Murphy"]
},
"id" : {
"type": "string",
"pattern": "^%user_id_pattern%$"
},
"mail": {
"type": "string",
"enum": ["brian@example.com"]
},
"onPremisesSamAccountName": {
"type": "string",
"enum": ["Brian"]
},
"accountEnabled": {
"type": "boolean",
"enum": [true]
}
}
}
"""
@skipOnStable2.0
Scenario Outline: a normal user should not be able to enable another user
@@ -254,9 +458,41 @@ Feature: edit user
Then the HTTP status code should be "401"
When user "Alice" gets information of user "Carol" using Graph API
Then the HTTP status code should be "200"
And the user retrieve API response should contain the following information:
| displayName | id | mail | onPremisesSamAccountName | accountEnabled |
| Carol King | %uuid_v4% | carol@example.org | Carol | false |
And the JSON data of the response should match
"""
{
"type": "object",
"required": [
"displayName",
"id",
"mail",
"onPremisesSamAccountName",
"accountEnabled"
],
"properties": {
"displayName": {
"type": "string",
"enum": ["Carol King"]
},
"id" : {
"type": "string",
"pattern": "^%user_id_pattern%$"
},
"mail": {
"type": "string",
"enum": ["carol@example.org"]
},
"onPremisesSamAccountName": {
"type": "string",
"enum": ["Carol"]
},
"accountEnabled": {
"type": "boolean",
"enum": [false]
}
}
}
"""
Examples:
| role |
| Space Admin |