Skip to content

Commit

Permalink
use OPTIONS /api/providers
Browse files Browse the repository at this point in the history
  • Loading branch information
Erez Freiberger committed Aug 13, 2017
1 parent 441738c commit 44e7509
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/controllers/api/providers_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@ def import_vm_resource(type, id = nil, data = {})
end
end

def options
all_options = ManageIQ::Providers::BaseManager.leaf_subclasses.inject({}) do |ao, ems|
ao.merge(ems.ems_type => ems.respond_to?(:provider_settings) ? ems.provider_settings : {})
end
render_options(:providers, all_options)
end

private

def format_provider_custom_attributes(attribute)
Expand Down
10 changes: 10 additions & 0 deletions spec/requests/providers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1134,4 +1134,14 @@ def gen_import_request
end
end
end

context "OPTIONS /api/providers" do
it "returns options for all providers when no query" do
run_options(providers_url)
expect(response.parsed_body["data"].keys.count).to eq(
ManageIQ::Providers::BaseManager.leaf_subclasses.count
)
expect(response.parsed_body["data"]["kubernetes"]["proxy_settings"]["settings"]["http_proxy"]["label"]).to eq(N_('HTTP Proxy'))
end
end
end

0 comments on commit 44e7509

Please sign in to comment.