diff options
author | Azul <azul@riseup.net> | 2018-01-19 14:11:24 +0100 |
---|---|---|
committer | Azul <azul@riseup.net> | 2018-01-19 14:11:24 +0100 |
commit | 54653f75cf44890310a06c3a8a6be59625629d2a (patch) | |
tree | 3a1c851033c46e1a140de3e3b5a17ad4b7f2647e /features/2 | |
parent | b8ba4f27a82868e0b3338b4af761f7c44226e729 (diff) |
API: implement deleting keys through new keys api
Diffstat (limited to 'features/2')
-rw-r--r-- | features/2/keys.feature | 89 |
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 |