Skip to content

Commit

Permalink
Merge pull request #9570 from isimluk/rhbz#1351253
Browse files Browse the repository at this point in the history
API: Allow security_protocol specified during provider creation
  • Loading branch information
abellotti committed Jul 8, 2016
2 parents c78c373 + 7731386 commit 0a5456b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
2 changes: 1 addition & 1 deletion app/controllers/api_controller/providers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Providers
CREDENTIALS_ATTR = "credentials"
AUTH_TYPE_ATTR = "auth_type"
DEFAULT_AUTH_TYPE = "default"
ENDPOINT_ATTRS = %w(hostname ipaddress port)
ENDPOINT_ATTRS = %w(hostname ipaddress port security_protocol).freeze
RESTRICTED_ATTRS = [TYPE_ATTR, CREDENTIALS_ATTR, ZONE_ATTR, "zone_id"]

def create_resource_providers(type, _id, data = {})
Expand Down
28 changes: 17 additions & 11 deletions spec/requests/api/providers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,22 @@
end
let(:sample_rhevm) do
{
"type" => "ManageIQ::Providers::Redhat::InfraManager",
"name" => "sample rhevm",
"port" => 5000,
"hostname" => "sample_rhevm.provider.com",
"ipaddress" => "100.200.300.2"
"type" => "ManageIQ::Providers::Redhat::InfraManager",
"name" => "sample rhevm",
"port" => 5000,
"hostname" => "sample_rhevm.provider.com",
"ipaddress" => "100.200.300.2",
'security_protocol' => 'kerberos',
}
end
let(:sample_openshift) do
{
"type" => "ManageIQ::Providers::Openshift::ContainerManager",
"name" => "sample openshift",
"port" => "8443",
"hostname" => "sample_openshift.provider.com",
"ipaddress" => "100.200.300.3",
"type" => "ManageIQ::Providers::Openshift::ContainerManager",
"name" => "sample openshift",
"port" => 8443,
"hostname" => "sample_openshift.provider.com",
"ipaddress" => "100.200.300.3",
'security_protocol' => 'kerberos',
}
end

Expand Down Expand Up @@ -124,7 +126,11 @@

provider_id = response_hash["results"].first["id"]
expect(ExtManagementSystem.exists?(provider_id)).to be_truthy
expect(ExtManagementSystem.find(provider_id).authentications.size).to eq(1)
ems = ExtManagementSystem.find(provider_id)
expect(ems.authentications.size).to eq(1)
ENDPOINT_ATTRS.each do |attr|
expect(ems.send(attr)).to eq(sample_openshift[attr])
end
end

it "supports single provider creation via action" do
Expand Down

0 comments on commit 0a5456b

Please sign in to comment.