summaryrefslogtreecommitdiff
path: root/features/api/nodes/update_node_api.feature
blob: 0acf6a7f47bf88902a7dd0f6b1738eceff596c56 (plain)
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
52
53
54
55
@api @api_nodes @nodes_update
Feature: Update a node
  In order to keep my node data up-to-date
  As a Developer
  I want to update my node via the API

  Scenario Outline: Update a node
    Given I am an administrator
      And a 'node' named 'webserver' exists
      And sending the method '<method>' to the 'node' with '<updated_value>'
     When I 'PUT' the 'node' to the path '/nodes/webserver'
     Then the inflated response should respond to '<method>' with '<updated_value>'
     When I 'GET' the path '/nodes/webserver'
     Then the inflated response should respond to '<method>' with '<updated_value>'

    Examples:
      | method           | updated_value                    |
      | run_list         | [ "recipe[one]", "recipe[two]" ] |
      | snakes           | really arent so bad              |
      | chef_environment | prod                             |

  @PL-493
  Scenario: Update a node to include a role which includes another role
    Given I am an administrator
      And a 'node' named 'webserver' exists
      And sending the method 'run_list' to the 'node' with '[ "role[role1_includes_role2]" ]'
     When I 'PUT' the 'node' to the path '/nodes/webserver'
     Then the inflated response should respond to 'run_list' with '[ "role[role1_includes_role2]" ]'
     When I 'GET' the path '/nodes/webserver'
     Then the inflated response should respond to 'run_list' with '[ "role[role1_includes_role2]" ]'

  Scenario: Update a node with a wrong private key
    Given I am an administrator
      And a 'node' named 'webserver' exists
      And sending the method 'run_list' to the 'node' with '[ "recipe[one]", "recipe[two]" ]'
     When I 'PUT' the 'node' to the path '/nodes/webserver' using a wrong private key
     Then I should get a '401 "Unauthorized"' exception

  @oss_only
  Scenario: Update a node when I am not an admin
    Given I am a non-admin
      And a 'node' named 'webserver' exists
      And sending the method 'run_list' to the 'node' with '[ "recipe[one]", "recipe[two]" ]'
     When I 'PUT' the 'node' to the path '/nodes/webserver'
     Then I should get a '403 "Forbidden"' exception

   Scenario: Update a node with a role that does not exist
     Given I am an administrator
       And a 'node' named 'webserver' exists
       And sending the method 'run_list' to the 'node' with '["role[not_exist]"]'
      When I 'PUT' the 'node' to the path '/nodes/webserver'
      Then the inflated response should respond to 'run_list' with '["role[not_exist]"]'
      When I 'GET' the path '/nodes/webserver'
      Then the inflated response should respond to 'run_list' with '["role[not_exist]"]'