@@ -22,7 +22,7 @@ Feature: Generate authentication token for environment
2222 When I send a GET request to "/accounts/test1/environments/$0/tokens"
2323 Then the response status should be "403"
2424
25- Scenario : Isolated admin generates a token for an isolated environment
25+ Scenario : Isolated admin generates a token for an isolated environment (by ID)
2626 Given the current account is "test1"
2727 And the current account has 1 isolated "environment"
2828 And the current account has 1 isolated "admin"
@@ -70,6 +70,54 @@ Feature: Generate authentication token for environment
7070 And sidekiq should have 1 "metric" job
7171 And sidekiq should have 1 "request-log" job
7272
73+ Scenario : Isolated admin generates a token for an isolated environment (by code)
74+ Given the current account is "test1"
75+ And the current account has 1 isolated "environment"
76+ And the current account has 1 isolated "admin"
77+ And I am the last admin of account "test1"
78+ And I use an authentication token
79+ And I send the following headers:
80+ """
81+ { "Keygen-Environment": "isolated" }
82+ """
83+ When I send a POST request to "/accounts/test1/environments/isolated/tokens" with the following:
84+ """
85+ {
86+ "data": {
87+ "type": "tokens",
88+ "attributes": {
89+ "name": "Isolated Token"
90+ }
91+ }
92+ }
93+ """
94+ Then the response status should be "201"
95+ And the response body should be a "token" with the following relationships:
96+ """
97+ {
98+ "environment": {
99+ "links": { "related": "/v1/accounts/$account/environments/$environments[0]" },
100+ "data": { "type": "environments", "id": "$environments[0]" }
101+ }
102+ }
103+ """
104+ And the response body should be a "token" with the following attributes:
105+ """
106+ {
107+ "name": "Isolated Token",
108+ "kind": "environment-token",
109+ "expiry": null
110+ }
111+ """
112+ And the response should contain a valid signature header for "test1"
113+ And the response should contain the following headers:
114+ """
115+ { "Keygen-Environment": "isolated" }
116+ """
117+ And sidekiq should have 0 "webhook" jobs
118+ And sidekiq should have 1 "metric" job
119+ And sidekiq should have 1 "request-log" job
120+
73121 Scenario : Shared admin generates a token for an isolated environment
74122 Given the current account is "test1"
75123 And the current account has 1 isolated "environment"
0 commit comments