Repository navigation
Expand file tree
/
Copy pathupdate_environment_api.feature
More file actions
51 lines (44 loc) · 2.32 KB
/
Copy pathupdate_environment_api.feature
File metadata and controls
51 lines (44 loc) · 2.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
@api @api_environments @environments_update
Feature: Update an environment via the REST API
In order to keep my environment data up-to-date
As a developer
I want to update my environment via the REST API
Scenario Outline: Update an environment
Given I am an administrator
And an 'environment' named 'cucumber' exists
And sending the method '<method>' to the 'environment' with '<updated_value>'
When I 'PUT' the 'environment' to the path '/environments/cucumber'
Then the inflated response should respond to '<method>' with '<updated_value>'
When I 'GET' the path '/environments/cucumber'
Then the inflated response should respond to '<method>' with '<updated_value>'
Examples:
| method | updated_value |
| description | I am a pickle |
| cookbook_versions | {"apt": "1.2.3"} |
Scenario: Update an environment that does not exist
Given I am an administrator
And an 'environment' named 'cucumber'
And sending the method 'description' to the 'environment' with 'This will not work'
When I 'PUT' the 'environment' to the path '/environments/cucumber'
Then I should get a '404 "Not Found"' exception
Scenario: Update an environment with the wrong private key
Given I am an administrator
And an 'environment' named 'cucumber' exists
And sending the method 'description' to the 'environment' with 'This will not work'
When I 'PUT' the 'environment' to the path '/environments/cucumber' using a wrong private key
Then I should get a '401 "Unauthorized"' exception
Scenario: Update an environment as a non-admin user
Given I am a non-admin
And an 'environment' named 'cucumber' exists
And sending the method 'description' to the 'environment' with 'This will not work'
When I 'PUT' the 'environment' to the path '/environments/cucumber'
Then I should get a '403 "Forbidden"' exception
Scenario Outline: Update the '_default' environment
Given I am <user_type>
And an 'environment' named 'cucumber'
When I 'PUT' the 'environment' to the path '/environments/_default'
Then I should get a '<exception_type>' exception
Examples:
| user_type | exception_type |
| an administrator | 405 "Method Not Allowed" |
| a non-admin | 403 "Forbidden" |