summaryrefslogtreecommitdiff
path: root/features/api/cookbooks/delete_cookbooks.feature
blob: 951543193f475a30d2daf826e4ad85c2588b0dfa (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
56
57
58
59
60
61
@api @cookbooks @api_cookbooks_delete
@manage_cookbook

Feature: CRUD cookbooks
  In order to manage cookbook data
  As a Developer
  I want to delete cookbook versions

  @delete_cookbook_positive @delete_cookbook_version_positive
  Scenario: After uploading two versions of a cookbook, then deleting the second, I should not be able to interact with the second but should be able to interact with the first
    Given I am an administrator
     When I fully upload a sandboxed cookbook named 'testcookbook_valid' versioned '0.1.0' with 'testcookbook_valid'
      And I fully upload a sandboxed cookbook force-named 'testcookbook_valid' versioned '0.2.0' with 'testcookbook_valid_v0.2.0'
     When I 'GET' to the path '/cookbooks/testcookbook_valid/0.2.0'
     Then I should not get an exception
     When I 'DELETE' to the path '/cookbooks/testcookbook_valid/0.2.0'
     When I 'GET' to the path '/cookbooks/testcookbook_valid'
     Then the inflated responses key 'testcookbook_valid' should exist
     Then the inflated responses key 'testcookbook_valid' sub-key 'versions' should be '1' items long
     Then the inflated responses key 'testcookbook_valid' sub-key 'versions' item '0' sub-key 'version' should equal '0.1.0'
     When I 'GET' to the path '/cookbooks/testcookbook_valid/0.2.0'
     Then I should get a '404 "Not Found"' exception
     When I download the cookbook manifest for 'testcookbook_valid' version '0.1.0'
     Then I should not get an exception
     When I download the file 'recipes/default.rb' from the downloaded cookbook manifest
     Then the downloaded cookbook file contents should match the pattern '.*0.1.0.*'

  @delete_cookbook_negative @delete_cookbook_version_negative
  Scenario: I should not be able to delete a cookbook version that does not exist
    Given I am an administrator
     When I fully upload a sandboxed cookbook named 'testcookbook_valid' versioned '0.1.0' with 'testcookbook_valid'
      And I fully upload a sandboxed cookbook force-named 'testcookbook_valid' versioned '0.2.0' with 'testcookbook_valid_v0.2.0'
     When I 'DELETE' to the path '/cookbooks/testcookbook_valid/0.3.0'
     Then I should get a '404 "Not Found"' exception

  # Currently you cannot delete a cookbook by, e.g., DELETE /cookbooks/foo.
  # You delete all of its versions and then it disappears.     
  @delete_cookbook_positive
  Scenario: I should be able to delete a cookbook by deleting all of its versions
    Given I am an administrator
     When I fully upload a sandboxed cookbook named 'testcookbook_valid' versioned '0.1.0' with 'testcookbook_valid'
     When I 'DELETE' to the path '/cookbooks/testcookbook_valid/0.1.0'
     Then I should not get an exception
     When I 'GET' the path '/cookbooks'
     Then the inflated responses key 'testcookbook_valid' should not exist
     When I 'GET' the path '/cookbooks/testcookbook_valid'
     Then I should get a '404 "Not Found"' exception
     
  @delete_cookbook_negative
  Scenario: I should not be able to delete a cookbook that doesn't exist'
    Given I am an administrator
     When I 'DELETE' to the path '/cookbooks/testcookbook_nonexistent/1.2.3'
     Then I should get a '404 "Not Found"' exception

  @delete_cookbook_negative @cookbook_non_admin
  Scenario: I should not be able to delete cookbook if I am not an admin
    Given I am an administrator
     When I fully upload a sandboxed cookbook named 'testcookbook_valid' versioned '0.1.0' with 'testcookbook_valid'
    Given I am a non-admin
     When I 'DELETE' to the path '/cookbooks/testcookbook_valid/0.1.0'
     Then I should get a '403 "Forbidden"' exception