-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add delete endpoint for portfolio_item #84
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
let(:service_offering_ref) { "998" } | ||
let(:order) { create(:order) } | ||
let(:portfolio_item) { create(:portfolio_item, :service_offering_ref => service_offering_ref) } | ||
let(:portfolio_item_id) { portfolio_item.id } | ||
let(:svc_object) { instance_double("ServiceCatalog::ServicePlans") } | ||
let(:plans) { [{}, {}] } | ||
let(:topo_ex) { ServiceCatalog::TopologyError.new("kaboom") } | ||
|
@@ -12,6 +13,21 @@ | |
allow(ServiceCatalog::ServicePlans).to receive(:new).with(portfolio_item.id.to_s).and_return(svc_object) | ||
end | ||
|
||
describe 'DELETE admin tagged /portfolio_items/:portfolio_item_id' do | ||
#TODO https://github.com/ManageIQ/service_portal-api/issues/85 | ||
let(:valid_attributes) { { :name => 'PatchPortfolio', :description => 'description for patched portfolio' } } | ||
|
||
context 'when :portfolio_item_id is valid' do | ||
before do | ||
delete "/api/v0.0/portfolio_items/#{portfolio_item_id}", :headers => admin_headers, :params => valid_attributes | ||
end | ||
|
||
it 'deletes the record' do | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @syncrou Do we need a TODO to add a test as a non admin user it should fail. Since we don't have any constraints check now we would have to wait. Also a GitHub issue might help There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added a TODO that points to this Issue: #85 |
||
expect(response).to have_http_status(204) | ||
end | ||
end | ||
end | ||
|
||
it "fetches plans" do | ||
allow(svc_object).to receive(:process).and_return(svc_object) | ||
allow(svc_object).to receive(:items).and_return(plans) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@syncrou The 204 status reads
@lgalis Is the UI going to react properly for a 204, it would have to issue a refresh of the portfolio items page