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 Sep 3, 2017
1 parent 74db741 commit 37f3b81
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
providers_options = ManageIQ::Providers::BaseManager.leaf_subclasses.inject({}) do |po, ems|
po.merge(ems.ems_type => ems.options_description)
end
render_options(:providers, {"provider_settings" => providers_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"]["provider_settings"].keys.count).to eq(
ManageIQ::Providers::BaseManager.leaf_subclasses.count
)
expect(response.parsed_body["data"]["provider_settings"]["kubernetes"]["proxy_settings"]["settings"]["http_proxy"]["label"]).to eq(N_('HTTP Proxy'))
end
end
end

0 comments on commit 37f3b81

Please sign in to comment.