summaryrefslogtreecommitdiff
path: root/features/api
diff options
context:
space:
mode:
authorNuo Yan <nuo@opscode.com>2010-11-07 17:15:19 -0800
committerDaniel DeLeo <dan@opscode.com>2011-02-02 12:20:37 -0800
commitf6a82394b9e012fe64b608eea81a9573788cdd1c (patch)
tree36fca0f1007737e923a4c546e0735687a3bba897 /features/api
parentf50475eebd4d687fcc1439049d6e22eb5c63324f (diff)
downloadchef-f6a82394b9e012fe64b608eea81a9573788cdd1c.tar.gz
add @oss_only tag to appropriate tests and refactor some search tests
Diffstat (limited to 'features/api')
-rw-r--r--features/api/clients/delete_client_api.feature17
-rw-r--r--features/api/clients/list_clients_api.feature3
-rw-r--r--features/api/nodes/delete_node_api.feature15
-rw-r--r--features/api/nodes/update_node_api.feature19
-rw-r--r--features/api/roles/create_role_api.feature17
-rw-r--r--features/api/roles/delete_role_api.feature17
-rw-r--r--features/api/roles/list_roles_api.feature7
-rw-r--r--features/api/search/show_search.feature72
8 files changed, 84 insertions, 83 deletions
diff --git a/features/api/clients/delete_client_api.feature b/features/api/clients/delete_client_api.feature
index 1d857e98fe..62f4b2373b 100644
--- a/features/api/clients/delete_client_api.feature
+++ b/features/api/clients/delete_client_api.feature
@@ -1,27 +1,28 @@
@api @api_clients @clients_delete
-Feature: Delete a client via the REST API
- In order to remove a client
- As a Developer
+Feature: Delete a client via the REST API
+ In order to remove a client
+ As a Developer
I want to delete a client via the REST API
-
- Scenario: Delete a client
+
+ Scenario: Delete a client
Given I am an administrator
And a 'client' named 'isis' exists
When I 'DELETE' the path '/clients/isis'
- Then the inflated responses key 'name' should match '^isis$'
+ Then the inflated responses key 'name' should match '^isis$'
Scenario: Delete a client that does not exist
Given I am an administrator
- And there are no clients
+ And there are no clients
When I 'DELETE' the path '/clients/isis'
Then I should get a '404 "Not Found"' exception
-
+
Scenario: Delete a client with a wrong private key
Given I am an administrator
And a 'client' named 'isis' exists
When I 'DELETE' the path '/clients/isis' using a wrong private key
Then I should get a '401 "Unauthorized"' exception
+ @oss_only
Scenario: Delete a client when you are not an admin
Given I am a non-admin
And a 'client' named 'isis' exists
diff --git a/features/api/clients/list_clients_api.feature b/features/api/clients/list_clients_api.feature
index e881d16396..ba8f224990 100644
--- a/features/api/clients/list_clients_api.feature
+++ b/features/api/clients/list_clients_api.feature
@@ -20,10 +20,11 @@ Feature: List clients via the REST API
Scenario: List clients when none have been created with a wrong private key
Given I am an administrator
- And there are no clients
+ And there are no clients
When I 'GET' the path '/clients' using a wrong private key
Then I should get a '401 "Unauthorized"' exception
+ @oss_only
Scenario: List clients when one has been created and you are not an admin
Given I am a non-admin
Given a 'client' named 'isis' exists
diff --git a/features/api/nodes/delete_node_api.feature b/features/api/nodes/delete_node_api.feature
index 68d82eae24..b7d585de51 100644
--- a/features/api/nodes/delete_node_api.feature
+++ b/features/api/nodes/delete_node_api.feature
@@ -1,18 +1,18 @@
@api @api_nodes @nodes_delete
-Feature: Delete a node via the REST API
- In order to remove a node
- As a Developer
+Feature: Delete a node via the REST API
+ In order to remove a node
+ As a Developer
I want to delete a node via the REST API
-
- Scenario: Delete a node
+
+ Scenario: Delete a node
Given I am an administrator
And a 'node' named 'webserver' exists
When I 'DELETE' the path '/nodes/webserver'
- Then the inflated response should respond to 'name' with 'webserver'
+ Then the inflated response should respond to 'name' with 'webserver'
Scenario: Delete a node that does not exist
Given I am an administrator
- And there are no nodes
+ And there are no nodes
When I 'DELETE' the path '/nodes/webserver'
Then I should get a '404 "Not Found"' exception
@@ -22,6 +22,7 @@ Feature: Delete a node via the REST API
When I 'DELETE' the path '/nodes/webserver' using a wrong private key
Then I should get a '401 "Unauthorized"' exception
+ @oss_only
Scenario: Delete a node as a when I am not an admin
Given I am a non-admin
And a 'node' named 'webserver' exists
diff --git a/features/api/nodes/update_node_api.feature b/features/api/nodes/update_node_api.feature
index 78853d299d..0acf6a7f47 100644
--- a/features/api/nodes/update_node_api.feature
+++ b/features/api/nodes/update_node_api.feature
@@ -2,16 +2,16 @@
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
+ I want to update my node via the API
- Scenario Outline: Update a node
+ 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 '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>'
+ Then the inflated response should respond to '<method>' with '<updated_value>'
Examples:
| method | updated_value |
@@ -25,7 +25,7 @@ Feature: Update a node
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]" ]'
+ 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]" ]'
@@ -36,19 +36,20 @@ Feature: Update a node
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 '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]"]'
diff --git a/features/api/roles/create_role_api.feature b/features/api/roles/create_role_api.feature
index 9b2654dfa6..d364a9136c 100644
--- a/features/api/roles/create_role_api.feature
+++ b/features/api/roles/create_role_api.feature
@@ -1,20 +1,20 @@
@api @api_roles @roles_create
Feature: Create a role via the REST API
- In order to create roles programatically
+ In order to create roles programatically
As a Devleoper
I want to create roles via the REST API
-
- Scenario: Create a new role
+
+ Scenario: Create a new role
Given I am an administrator
And a 'role' named 'webserver'
- When I 'POST' the 'role' to the path '/roles'
+ When I 'POST' the 'role' to the path '/roles'
And the inflated responses key 'uri' should match '^http://.+/roles/webserver$'
Scenario: Create a role that already exists
Given I am an administrator
And an 'role' named 'webserver'
- When I 'POST' the 'role' to the path '/roles'
- And I 'POST' the 'role' to the path '/roles'
+ When I 'POST' the 'role' to the path '/roles'
+ And I 'POST' the 'role' to the path '/roles'
Then I should get a '409 "Conflict"' exception
Scenario: Create a new role with a wrong private key
@@ -23,16 +23,17 @@ Feature: Create a role via the REST API
When I 'POST' the 'role' to the path '/roles' using a wrong private key
Then I should get a '401 "Unauthorized"' exception
+ @oss_only
Scenario: Create a new role as a non-admin
Given I am a non-admin
And a 'role' named 'webserver'
- When I 'POST' the 'role' to the path '/roles'
+ When I 'POST' the 'role' to the path '/roles'
Then I should get a '403 "Forbidden"' exception
Scenario: Create a role with a role that does not exist
Given I am an administrator
And an 'role' named 'role_not_exist'
- When I 'POST' the 'role' to the path '/roles'
+ When I 'POST' the 'role' to the path '/roles'
Then the inflated responses key 'uri' should match '^http://.+/roles/role_not_exist$'
When I 'GET' the path '/roles/role_not_exist'
Then the stringified response should be the stringified 'role'
diff --git a/features/api/roles/delete_role_api.feature b/features/api/roles/delete_role_api.feature
index c7bd9f05c0..d1e28c15f0 100644
--- a/features/api/roles/delete_role_api.feature
+++ b/features/api/roles/delete_role_api.feature
@@ -1,27 +1,28 @@
@api @api_roles @roles_delete
-Feature: Delete a Role via the REST API
- In order to remove a role
- As a Developer
+Feature: Delete a Role via the REST API
+ In order to remove a role
+ As a Developer
I want to delete a role via the REST API
-
- Scenario: Delete a Role
+
+ Scenario: Delete a Role
Given I am an administrator
And a 'role' named 'webserver' exists
When I 'DELETE' the path '/roles/webserver'
- Then the inflated response should respond to 'name' with 'webserver'
+ Then the inflated response should respond to 'name' with 'webserver'
Scenario: Delete a Role that does not exist
Given I am an administrator
- And there are no roles
+ And there are no roles
When I 'DELETE' the path '/roles/webserver'
Then I should get a '404 "Not Found"' exception
-
+
Scenario: Delete a Role with a wrong private key
Given I am an administrator
And a 'role' named 'webserver' exists
When I 'DELETE' the path '/roles/webserver' using a wrong private key
Then I should get a '401 "Unauthorized"' exception
+ @oss_only
Scenario: Delete a Role as a non-admin
Given I am a non-admin
And a 'role' named 'webserver' exists
diff --git a/features/api/roles/list_roles_api.feature b/features/api/roles/list_roles_api.feature
index 621dc4c2a4..9c7adca175 100644
--- a/features/api/roles/list_roles_api.feature
+++ b/features/api/roles/list_roles_api.feature
@@ -21,14 +21,13 @@ Feature: List roles via the REST API
And a 'role' named 'webserver' exists
And a 'role' named 'db' exists
When I 'GET' the path '/roles'
- Then the inflated response should be '4' items long
- And the inflated responses key 'role_test' should match '^http://.+/roles/role_test$'
- And the inflated responses key 'webserver' should match '^http://.+/roles/webserver$'
+# Then the inflated responses key 'role_test' should match '^http://.+/roles/role_test$'
+ Then the inflated responses key 'webserver' should match '^http://.+/roles/webserver$'
And the inflated responses key 'db' should match '^http://.+/roles/db$'
Scenario: List roles when none have been created with a wrong private key
Given I am an administrator
- And there are no roles
+ And there are no roles
When I 'GET' the path '/roles' using a wrong private key
Then I should get a '401 "Unauthorized"' exception
diff --git a/features/api/search/show_search.feature b/features/api/search/show_search.feature
index 5bdb50b5a5..94b0ec8c1b 100644
--- a/features/api/search/show_search.feature
+++ b/features/api/search/show_search.feature
@@ -2,13 +2,13 @@
Feature: Search data via the REST API
In order to know about objects in the system
As a Developer
- I want to search the objects
+ I want to search the objects
Scenario: Search for objects when none have been created
Given I am an administrator
And a 'data_bag' named 'users' exists
When I authenticate as 'bobo'
- And I 'GET' the path '/search/users'
+ And I 'GET' the path '/search/users'
Then the inflated responses key 'rows' should be '0' items long
And the inflated responses key 'start' should be the integer '0'
And the inflated responses key 'total' should be the integer '0'
@@ -17,96 +17,92 @@ Feature: Search data via the REST API
Given I am an administrator
And a 'data_bag' named 'users' exists
And a 'data_bag_item' named 'francis' exists
- And I wait for '15' seconds
+ And the search index has been committed
When I authenticate as 'bobo'
- And I 'GET' the path '/search/users'
- Then the inflated responses key 'rows' item '0' should be a kind of 'Chef::DataBagItem'
- And the inflated responses key 'rows' item '0' key 'id' should be 'francis'
- And the inflated responses key 'start' should be the integer '0'
- And the inflated responses key 'total' should be the integer '1'
+ And I 'GET' the path '/search/users'
+ Then a 'Chef::DataBagItem' with id 'francis' should be in the search result
+ And there should be '1' total search results
Scenario: Search for objects when two have been created
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
- And I wait for '15' seconds
+ And the search index has been committed
When I authenticate as 'bobo'
- And I 'GET' the path '/search/users'
- Then the inflated responses key 'rows' item '0' should be a kind of 'Chef::DataBagItem'
- And the inflated responses key 'rows' item '0' key 'id' should be 'francis'
- And the inflated responses key 'rows' item '1' should be a kind of 'Chef::DataBagItem'
- And the inflated responses key 'rows' item '1' key 'id' should be 'axl_rose'
- And the inflated responses key 'start' should be the integer '0'
- And the inflated responses key 'total' should be the integer '2'
+ And I 'GET' the path '/search/users'
+ Then a 'Chef::DataBagItem' with id 'francis' should be in the search result
+ And a 'Chef::DataBagItem' with id 'axl_rose' should be in the search result
+ And there should be '2' total search results
- Scenario: Search for objects with a manual ascending sort order
+ @oss_only
+ Scenario: Search for objects with a manual ascending sort order
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
- And I wait for '15' seconds
+ And the search index has been committed
When I authenticate as 'bobo'
- And I 'GET' the path '/search/users?sort=id+asc'
+ And I 'GET' the path '/search/users?sort=id+asc'
Then the inflated responses key 'rows' item '0' should be a kind of 'Chef::DataBagItem'
And the inflated responses key 'rows' item '0' key 'id' should be 'axl_rose'
And the inflated responses key 'rows' item '1' should be a kind of 'Chef::DataBagItem'
And the inflated responses key 'rows' item '1' key 'id' should be 'francis'
And the inflated responses key 'start' should be the integer '0'
- And the inflated responses key 'total' should be the integer '2'
+ And the inflated responses key 'total' should be the integer '2'
- Scenario: Search for objects with a manual descending sort order
+ @oss_only
+ Scenario: Search for objects with a manual descending sort order
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
- And I wait for '15' seconds
+ And the search index has been committed
When I authenticate as 'bobo'
- And I 'GET' the path '/search/users?sort=id+desc'
+ And I 'GET' the path '/search/users?sort=id+desc'
Then the inflated responses key 'rows' item '0' should be a kind of 'Chef::DataBagItem'
And the inflated responses key 'rows' item '0' key 'id' should be 'francis'
And the inflated responses key 'rows' item '1' should be a kind of 'Chef::DataBagItem'
And the inflated responses key 'rows' item '1' key 'id' should be 'axl_rose'
And the inflated responses key 'start' should be the integer '0'
- And the inflated responses key 'total' should be the integer '2'
+ And the inflated responses key 'total' should be the integer '2'
+ @oss_only
Scenario: Search for objects and page through the results
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
- And I wait for '15' seconds
+ And the search index has been committed
When I authenticate as 'bobo'
- And I 'GET' the path '/search/users?rows=1&sort=id+asc'
+ And I 'GET' the path '/search/users?rows=1&sort=id+asc'
Then the inflated responses key 'rows' item '0' should be a kind of 'Chef::DataBagItem'
And the inflated responses key 'rows' item '0' key 'id' should be 'axl_rose'
And the inflated responses key 'rows' should be '1' items long
And the inflated responses key 'start' should be the integer '0'
And the inflated responses key 'total' should be the integer '2'
- When I 'GET' the path '/search/users?rows=1&start=1&sort=id+asc'
+ When I 'GET' the path '/search/users?rows=1&start=1&sort=id+asc'
Then the inflated responses key 'rows' item '0' should be a kind of 'Chef::DataBagItem'
And the inflated responses key 'rows' item '0' key 'id' should be 'francis'
And the inflated responses key 'rows' should be '1' items long
And the inflated responses key 'start' should be the integer '1'
And the inflated responses key 'total' should be the integer '2'
- Scenario: Search for a subset of objects
+ Scenario: Search for a subset of objects
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
- And I wait for '15' seconds
+ And the search index has been committed
When I authenticate as 'bobo'
- And I 'GET' the path '/search/users?q=id:axl_rose'
- Then the inflated responses key 'rows' item '0' should be a kind of 'Chef::DataBagItem'
- And the inflated responses key 'rows' item '0' key 'id' should be 'axl_rose'
- And the inflated responses key 'start' should be the integer '0'
- And the inflated responses key 'total' should be the integer '1'
+ And I 'GET' the path '/search/users?q=id:axl_rose'
+ Then a 'Chef::DataBagItem' with id 'axl_rose' should be in the search result
+ And there should be '1' total search results
- Scenario: Search for a node
+ Scenario: Search for a node
Given I am an administrator
And a 'node' named 'searchman' exists
- And I wait for '15' seconds
+ And the search index has been committed
When I authenticate as 'bobo'
And I 'GET' the path '/search/node?q=recipe:oracle'
Then the inflated responses key 'rows' item '0' should be a kind of 'Chef::Node'
@@ -128,7 +124,7 @@ Feature: Search data via the REST API
And I 'GET' the path '/search/funkensteins'
Then I should get a '404 "Not Found"' exception
- Scenario: Search for objects when you are not authenticated
- When I 'GET' the path '/search/users'
+ Scenario: Search for objects when you are not authenticated
+ When I 'GET' the path '/search/users'
Then I should get a '401 "Unauthorized"' exception