Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
describe ManageIQ::Providers::IbmCloud::PowerVirtualServers::CloudManager do
it ".ems_type" do
expect(described_class.ems_type).to eq("ibm_cloud_power_virtual_servers")
end

let(:ems) do
uid_ems = VcrSecrets.ibm_cloud_power.cloud_instance_id
auth_key = VcrSecrets.ibm_cloud_power.api_key

FactoryBot.create(:ems_ibm_cloud_power_virtual_servers_cloud, :uid_ems => uid_ems).tap do |ems|
ems.authentications << FactoryBot.create(:authentication, :auth_key => auth_key)
end
end

it "verify credentials" do
VCR.use_cassette(described_class.name.underscore) do
ems.verify_credentials
end
end
end
6 changes: 3 additions & 3 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def replace_ssh_keys(response)
# Replace the contents of the token before writing to file.
def replace_token_contents(interaction)
data = JSON.parse(interaction.response.body, :symbolize_names => true)
data.merge!({:refresh_token => 'REFRESH_TOKEN', :ims_user_id => '22222', :expiration => Date.new(2100, 1, 1).to_time.to_i})
data.merge!({:access_token => 'ACCESS_TOKEN', :refresh_token => 'REFRESH_TOKEN', :ims_user_id => '22222', :expiration => Date.new(2100, 1, 1).to_time.to_i})
interaction.response.body = data.to_json.force_encoding('ASCII-8BIT')

transient_headers = %w[].freeze
Expand Down Expand Up @@ -65,8 +65,8 @@ def header_sanitizer(response_header, transient_headers)
config.configure_rspec_metadata! # Auto-detects the cassette name based on the example's full description

config.before_record do |i|
replace_token_contents(i) if i.request.uri == "https://iam.cloud.ibm.com/identity/token"
vpc_sanitizer(i) if i.request.uri.match?('iaas.cloud.ibm') || i.request.uri.match?('tags.global-search-tagging')
replace_token_contents(i) if i.request.uri.start_with?("https://iam.cloud.ibm.com/identity/token")
vpc_sanitizer(i) if i.request.uri.match?('cloud.ibm') || i.request.uri.match?('tags.global-search-tagging')
end

VcrSecrets.define_all_cassette_placeholders(config, :ibm_cloud_power)
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading