Skip to content

Commit

Permalink
adjust rspec to accomodate accepting userid in api_client_connection_…
Browse files Browse the repository at this point in the history
…for_region invocation
  • Loading branch information
yrudman committed Jun 4, 2020
1 parent a4d3daf commit 9cde7d7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
1 change: 0 additions & 1 deletion app/models/mixins/inter_region_api_method_relay.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ def self.api_client_connection_for_region(region_number, user = User.current_use

def self.exec_api_call(region, collection_name, action, api_args = nil, id = nil)
require 'manageiq-api-client'
_log.info("Executing InterRegion api call for region #{region} with arguments: #{api_args}")
api_args ||= {}
user_name = api_args[:requester]&.fetch("user_name")
user_name = User.current_user&.userid if user_name.blank?
Expand Down
3 changes: 2 additions & 1 deletion spec/models/mixins/inter_region_api_method_relay_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ def expect_api_call(expected_action, expected_args = nil)

describe ".exec_api_call" do
let(:region) { 0 }
let(:userid) { nil }
let(:action) { :the_action }
let(:api_connection) { double("ManageIQ::API::Client Connection") }
let(:api_collection) { double("ManageIQ::API::Client Collection", :name => collection_name) }
Expand All @@ -216,7 +217,7 @@ def expect_api_call(expected_action, expected_args = nil)
let(:api_resource) { ManageIQ::API::Client::Resource.subclass("test_resource").new(api_collection, {}) }

before do
expect(described_class).to receive(:api_client_connection_for_region).with(region).and_return(api_connection)
expect(described_class).to receive(:api_client_connection_for_region).with(region, userid).and_return(api_connection)
expect(api_connection).to receive(collection_name).and_return(api_collection)
end

Expand Down

0 comments on commit 9cde7d7

Please sign in to comment.