This repository has been archived by the owner on Mar 24, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Everything was in a single feature, which is very confusing.
- Loading branch information
Paul M Furley
committed
May 8, 2014
1 parent
9930519
commit 332481b
Showing
5 changed files
with
129 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
@use_write_api_client | ||
Feature: access_control | ||
|
||
Scenario: unauthorized when posting with an incorrect token | ||
Given I have JSON data '[]' | ||
and I have a data_set named "some_data_set" with settings | ||
| key | value | | ||
| data_group | "group" | | ||
| data_type | "type" | | ||
and I have the bearer token "invalid-bearer-token" | ||
when I POST to the specific path "/data/group/type" | ||
then I should get back a status of "401" | ||
and I should get a "WWW-Authenticate" header of "bearer" | ||
and I should get back the message "Unauthorized: Invalid bearer token "invalid-bearer-token"" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
@use_write_api_client | ||
Feature: create_collection | ||
|
||
Scenario: creating an uncapped collection | ||
Given I have JSON data '{"capped_size": 0}' | ||
and I have the bearer token "dev-create-endpoint-token" | ||
when I POST to the specific path "/data-sets/new-uncapped" | ||
then I should get back a status of "200" | ||
and the collection called "new-uncapped" should exist | ||
and the collection called "new-uncapped" should be uncapped | ||
|
||
Scenario: creating a capped collection | ||
Given I have JSON data '{"capped_size": 5040}' | ||
and I have the bearer token "dev-create-endpoint-token" | ||
when I POST to the specific path "/data-sets/new-capped" | ||
then I should get back a status of "200" | ||
and the collection called "new-capped" should exist | ||
and the collection called "new-capped" should be capped at "5040" | ||
|
||
Scenario: denying create collection with missing bearer token | ||
Given I have JSON data '{"capped_size": 0}' | ||
when I POST to the specific path "/data-sets/new-dataset" | ||
then I should get back a status of "401" | ||
and I should get a "WWW-Authenticate" header of "bearer" | ||
and I should get back the message "Unauthorized: invalid or no token given." | ||
|
||
Scenario: denying create collection with incorrect bearer token | ||
Given I have JSON data '{"capped_size": 0}' | ||
and I have the bearer token "invalid-bearer-token" | ||
when I POST to the specific path "/data-sets/new-dataset" | ||
then I should get back a status of "401" | ||
and I should get a "WWW-Authenticate" header of "bearer" | ||
and I should get back the message "Unauthorized: invalid or no token given." | ||
|
||
Scenario: not creating a collection if it already exists | ||
Given I have JSON data '{"capped_size": 4096}' | ||
and I have the bearer token "dev-create-endpoint-token" | ||
when I POST to the specific path "/data-sets/some-dataset" | ||
and I POST to the specific path "/data-sets/some-dataset" | ||
then I should get back a status of "400" | ||
|
||
Scenario: rejecting a missing capped_size when creating a collection | ||
Given I have JSON data '{}' | ||
and I have the bearer token "dev-create-endpoint-token" | ||
and I have a data_set named "new-dataset" with settings | ||
| key | value | | ||
when I POST to the specific path "/data-sets/new-dataset" | ||
then I should get back a status of "400" | ||
and the collection called "new-dataset" should not exist | ||
|
||
Scenario: rejecting an invalid capped_size when creating a collection | ||
Given I have JSON data '{"capped_size": "invalid"}' | ||
and I have the bearer token "dev-create-endpoint-token" | ||
when I POST to the specific path "/data-sets/new-dataset" | ||
then I should get back a status of "400" | ||
and the collection called "new-dataset" should not exist | ||
|
||
Scenario: rejecting an invalid JSON body when creating a collection | ||
Given I have JSON data '{broken}' | ||
and I have the bearer token "dev-create-endpoint-token" | ||
when I POST to the specific path "/data-sets/new-dataset" | ||
then I should get back a status of "400" | ||
and the collection called "new-dataset" should not exist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
@use_write_api_client | ||
Feature: delete_data_set | ||
|
||
@delete_things | ||
Scenario: deleting a data-set | ||
Given I have a data_set named "some-dataset" with settings | ||
| key | value | | ||
and I have JSON data '{"capped_size": 4096}' | ||
and I have the bearer token "dev-create-endpoint-token" | ||
when I POST to the specific path "/data-sets/some-dataset" | ||
then the collection called "some-dataset" should exist | ||
when I send a DELETE request to "/data-sets/some-dataset" | ||
then I should get back a status of "200" | ||
and I should get back the message "Deleted some-dataset" | ||
and the collection called "some-dataset" should not exist | ||
|
||
@delete_things | ||
Scenario: cannot delete a data-set that does not exist | ||
Given I have the bearer token "dev-create-endpoint-token" | ||
when I send a DELETE request to "/data-sets/some-dataset" | ||
then I should get back a status of "404" | ||
and I should get back the message "No collection exists with name "some-dataset"" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
@use_write_api_client | ||
Feature: empty_data_set | ||
|
||
@empty_data_set | ||
Scenario: emptying a data-set by PUTing an empty JSON list | ||
Given I have the data in "dinosaur.json" | ||
and I have a data_set named "some_data_set" with settings | ||
| key | value | | ||
| data_group | "group" | | ||
| data_type | "type" | | ||
and I use the bearer token for the data_set | ||
when I POST to the specific path "/data/group/type" | ||
given I have JSON data '[]' | ||
when I PUT to the specific path "/data/group/type" | ||
then I should get back a status of "200" | ||
and the collection called "some_data_set" should exist | ||
and the collection called "some_data_set" should contain 0 records | ||
and I should get back the message "some_data_set now contains 0 records" | ||
|
||
@empty_data_set | ||
Scenario: PUT is only implemented for an empty JSON list | ||
Given I have a data_set named "some_data_set" with settings | ||
| key | value | | ||
| data_group | "group" | | ||
| data_type | "type" | | ||
and I use the bearer token for the data_set | ||
given I have JSON data '[{"a": 1}]' | ||
when I PUT to the specific path "/data/group/type" | ||
then I should get back a status of "400" | ||
and I should get back the message "Not implemented: you can only pass an empty JSON list" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters