summaryrefslogtreecommitdiff
path: root/features/api/data/show_data_bag_api.feature
blob: 5e3b64d18e86d557e9a7f53e5d1f61dbef189cbe (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
@api @data @api_data
Feature: Show a data_bag via the REST API
  In order to know what the details are for a data_bag
  As a Developer
  I want to show the details for a specific data_bag

  Scenario: Show a data_bag with no entries in it
    Given I am an administrator
      And a 'data_bag' named 'users' exists
     When I authenticate as 'bobo'
      And I 'GET' the path '/data/users'
     Then the inflated response should be an empty hash

  Scenario: Show a data_bag with one entry in it
    Given I am an administrator
      And a 'data_bag' named 'users' exists
      And a 'data_bag_item' named 'francis' exists
     When I authenticate as 'bobo'
      And I 'GET' the path '/data/users'
     Then the inflated responses key 'francis' should match '/data/users/francis'

  Scenario: Show a data_bag with two entries in it
    Given I am an administrator
      And a 'data_bag' named 'users' exists
      And a 'data_bag_item' named 'francis' exists
      And a 'data_bag_item' named 'axl_rose' exists
     When I authenticate as 'bobo'
      And I 'GET' the path '/data/users'
     Then the inflated responses key 'francis' should match '/data/users/francis'
      And the inflated responses key 'axl_rose' should match '/data/users/axl_rose'

  Scenario: Show a missing data_bag
    Given I am an administrator
      And there are no data_bags
     When I authenticate as 'bobo'
      And I 'GET' the path '/data/users'
     Then I should get a '404 "Not Found"' exception

  Scenario: Show a data_bag without authenticating
    Given a 'data_bag' named 'users' exists
      And I 'GET' the path '/data/users'
     Then I should get a '400 "Bad Request"' exception

  Scenario: Show a data_bag with a wrong private key
    Given a 'registration' named 'bobo' exists
      And a 'data_bag' named 'users' exists
      And I 'GET' the path '/data/users' using a wrong private key
     Then I should get a '401 "Unauthorized"' exception