summaryrefslogtreecommitdiff
path: root/features/2/keys.feature
diff options
context:
space:
mode:
Diffstat (limited to 'features/2/keys.feature')
-rw-r--r--features/2/keys.feature89
1 files changed, 85 insertions, 4 deletions
diff --git a/features/2/keys.feature b/features/2/keys.feature
index cc87da0..83e70e7 100644
--- a/features/2/keys.feature
+++ b/features/2/keys.feature
@@ -114,6 +114,19 @@ Feature: Handle current users collection of keys
}
"""
+ Scenario: Publishing an empty key fails
+ When I send a POST request to "2/keys" with the following:
+ """
+ {}
+ """
+ Then the response status should be "422"
+ And the response should be:
+ """
+ {
+ "error": "param is missing or the value is empty: type"
+ }
+ """
+
Scenario: Updating an existing key
Given I have published a "openpgp" key
When I send a PATCH request to "2/keys/openpgp" with the following:
@@ -127,6 +140,24 @@ Feature: Handle current users collection of keys
Then the response status should be "204"
And I should have published a "openpgp" key with value "QWER"
+ Scenario: Updating a missing key raises
+ When I send a PATCH request to "2/keys/openpgp" with the following:
+ """
+ {
+ "type": "openpgp",
+ "value": "QWER",
+ "rev": "DUMMY_REV"
+ }
+ """
+ Then the response status should be "404"
+ And the response should be:
+ """
+ {
+ "error": "no such key: openpgp"
+ }
+ """
+ And I should not have published a "openpgp" key
+
Scenario: Updating an existing key require revision
Given I have published a "openpgp" key
When I send a PATCH request to "2/keys/openpgp" with the following:
@@ -162,15 +193,65 @@ Feature: Handle current users collection of keys
}
"""
- Scenario: Publishing an empty key fails
- When I send a POST request to "2/keys" with the following:
+ Scenario: Deleting an existing key
+ Given I have published a "openpgp" key
+ When I send a DELETE request to "2/keys/openpgp" with the following:
"""
- {}
+ {
+ "type": "openpgp",
+ "rev": "DUMMY_REV"
+ }
+ """
+ Then the response status should be "204"
+ And I should not have published a "openpgp" key
+
+ Scenario: Deleting a missing key raises
+ When I send a DELETE request to "2/keys/openpgp" with the following:
+ """
+ {
+ "type": "openpgp",
+ "rev": "DUMMY_REV"
+ }
+ """
+ Then the response status should be "404"
+ And the response should be:
+ """
+ {
+ "error": "no such key: openpgp"
+ }
+ """
+
+ Scenario: Deleting an existing key require revision
+ Given I have published a "openpgp" key
+ When I send a DELETE request to "2/keys/openpgp" with the following:
+ """
+ {
+ "type": "openpgp"
+ }
"""
Then the response status should be "422"
And the response should be:
"""
{
- "error": "param is missing or the value is empty: type"
+ "error": "param is missing or the value is empty: rev"
+ }
+ """
+ And I should have published a "openpgp" key
+
+ Scenario: Deleting an existing key require right revision
+ Given I have published a "openpgp" key
+ When I send a DELETE request to "2/keys/openpgp" with the following:
+ """
+ {
+ "type": "openpgp",
+ "rev": "WRONG_REV"
}
"""
+ Then the response status should be "422"
+ And the response should be:
+ """
+ {
+ "error": "wrong revision: WRONG_REV"
+ }
+ """
+ And I should have published a "openpgp" key