From a9048afc668b186445d56818cf15d871b2546a5e Mon Sep 17 00:00:00 2001 From: Tim Wade Date: Wed, 12 Apr 2017 11:30:20 -0700 Subject: [PATCH] Correctly configure custom attributes for DELETEs Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1422596 --- config/api.yml | 2 ++ spec/requests/api/custom_attributes_spec.rb | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/config/api.yml b/config/api.yml index adfcf9e2a40..ccc9deb398d 100644 --- a/config/api.yml +++ b/config/api.yml @@ -679,6 +679,8 @@ :post: - :name: edit - :name: delete + :delete: + - :name: delete :data_stores: :description: Datastores :identifier: storage diff --git a/spec/requests/api/custom_attributes_spec.rb b/spec/requests/api/custom_attributes_spec.rb index 64ce3d79c1d..b3e1b112553 100644 --- a/spec/requests/api/custom_attributes_spec.rb +++ b/spec/requests/api/custom_attributes_spec.rb @@ -1,4 +1,23 @@ RSpec.describe "Custom Attributes API" do + describe "GET /api//:cid/custom_attributes/:sid" do + it "renders the actions available on custom attribute members" do + vm = FactoryGirl.create(:vm_vmware) + custom_attribute = FactoryGirl.create(:custom_attribute, :resource => vm) + api_basic_authorize + + run_get("#{vms_url(vm.id)}/custom_attributes/#{custom_attribute.id}") + + expected = { + "actions" => a_collection_including( + a_hash_including("name" => "edit", "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 + it "can delete a custom attribute through its nested URI" do vm = FactoryGirl.create(:vm_vmware) custom_attribute = FactoryGirl.create(:custom_attribute, :resource => vm)