From 6a87cdc0975215b8d5b38a0876f0c9c46903683b Mon Sep 17 00:00:00 2001 From: Tim Wade Date: Mon, 17 Apr 2017 08:35:11 -0700 Subject: [PATCH] Render DELETE action for notifications Notifications can be deleted through the DELETE method, yet we don't render that as an available action when we return notification members through GET. This is beecause the method has been enabled but no action has been configured. Configuring a delete action solves this problem. Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1420872 --- config/api.yml | 2 ++ spec/requests/api/notifications_spec.rb | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/config/api.yml b/config/api.yml index ccc9deb398d..e0e56fa55b0 100644 --- a/config/api.yml +++ b/config/api.yml @@ -1019,6 +1019,8 @@ :post: - :name: mark_as_seen - :name: delete + :delete: + - :name: delete :orchestration_stacks: :description: Orchestration Stacks :options: diff --git a/spec/requests/api/notifications_spec.rb b/spec/requests/api/notifications_spec.rb index 6be285d806b..896ce260e06 100644 --- a/spec/requests/api/notifications_spec.rb +++ b/spec/requests/api/notifications_spec.rb @@ -15,6 +15,23 @@ end end + describe "notification read" do + it "renders the available actions" do + api_basic_authorize + + run_get(notification_url) + + expected = { + "actions" => a_collection_including( + a_hash_including("name" => "mark_as_seen", "method" => "post"), + a_hash_including("name" => "delete", "method" => "post"), + a_hash_including("name" => "delete", "method" => "delete") + ) + } + expect(response.parsed_body).to include(expected) + end + end + describe 'notification edit' do it 'is not supported' do api_basic_authorize