add test for creating auth tocken for an app using api

This commit is contained in:
Niraj Acharya
2024-12-11 11:54:30 +05:45
parent 1074b259f9
commit 6c00b5d26b
5 changed files with 312 additions and 0 deletions
@@ -0,0 +1,62 @@
Feature: create auth token
As a admin
I want to create App Tokens
So that I can use 3rd party apps
Scenario: admin creates app token
When the administrator creates app token with expiration time "72h" using the 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": {
"type": "string",
"pattern": "^[a-zA-Z0-9]{16}$"
},
"label": {
"const": "Generated via API"
}
}
}
"""
Scenario: admin lists app token
Given the administrator has created app token with expiration time "72h" using the API
When admin lists all created tokens
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
{
"type": "array",
"minItems": 1,
"maxItems": 1,
"items": {
"type": "object",
"required": [
"token",
"expiration_date",
"created_date",
"label"
],
"properties": {
"token": {
"type": "string",
"pattern": "^\\$2a\\$11\\$[A-Za-z0-9./]{53}$"
},
"label": {
"const": "Generated via API"
}
}
}
}
"""