add test for creating auth tocken for an app using impersonation api

This commit is contained in:
Niraj Acharya
2024-12-05 14:27:02 +05:45
parent 1f537b57fb
commit d601cb1d6d
4 changed files with 111 additions and 11 deletions

View File

@@ -31,9 +31,11 @@ Feature: create auth-app token
}
"""
Scenario: user lists app tokens
Given user "Alice" has created app token with expiration time "72h" using the auth-app API
@env-config
Scenario: user lists auth-app tokens generated by different auth-app api
Given the config "AUTH_APP_ENABLE_IMPERSONATION" has been set to "true"
And user "Alice" has created app token with expiration time "72h" using the auth-app API
And the administrator has created app token for user "Alice" with expiration time "72h" using the auth-app API
And user "Alice" has created app token with expiration time "72h" using the auth-app CLI
When user "Alice" lists all created tokens using the auth-app API
Then the HTTP status code should be "200"
@@ -41,8 +43,8 @@ Feature: create auth-app token
"""
{
"type": "array",
"minItems": 2,
"maxItems": 2,
"minItems": 3,
"maxItems": 3,
"uniqueItems": true,
"items": {
"oneOf": [
@@ -79,8 +81,51 @@ Feature: create auth-app token
"const": "Generated via CLI"
}
}
},
{
"type": "object",
"required": [
"token",
"expiration_date",
"created_date",
"label"
],
"properties": {
"token": {
"pattern": "^\\$2a\\$11\\$[A-Za-z0-9./]{53}$"
},
"label": {
"const": "Generated via Impersonation API"
}
}
}
]
}
}
"""
@env-config
Scenario: admin creates auth-app token for other user
Given the config "AUTH_APP_ENABLE_IMPERSONATION" has been set to "true"
When the administrator creates app token for user "Alice" with expiration time "72h" using the auth-app API
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
{
"type": "object",
"required": [
"token",
"expiration_date",
"created_date",
"label"
],
"properties": {
"token": {
"pattern": "^[a-zA-Z0-9]{16}$"
},
"label": {
"const": "Generated via Impersonation API"
}
}
}
"""