Skip to content

Commit

Permalink
Merge pull request #1267 from agrare/fix_cloud_networks_a_collection_…
Browse files Browse the repository at this point in the history
…including

Fix CloudNetworks spec with empty including()

(cherry picked from commit 4e4e1a0)
  • Loading branch information
jrafanie authored and Fryguy committed Oct 2, 2024
1 parent 4684141 commit c195eab
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions spec/requests/cloud_networks_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,21 @@

it 'successfully returns providers on query when providers do not have cloud_networks attribute' do
FactoryBot.create(:ems_container) # Openshift container manager does not respond to #cloud_networks
FactoryBot.create(:ems_cloud).tap { |x| 2.times { x.cloud_networks << FactoryBot.create(:cloud_network) } } # Provider with cloud networks
api_basic_authorize collection_action_identifier(:providers, :read, :get)

ems_cloud = FactoryBot.create(:ems_cloud) # Provider with cloud networks
cloud_network_1 = FactoryBot.create(:cloud_network, :ext_management_system => ems_cloud.network_manager)
cloud_network_2 = FactoryBot.create(:cloud_network, :ext_management_system => ems_cloud.network_manager)
api_basic_authorize collection_action_identifier(:providers, :read, :get)
get api_providers_url, :params => { :expand => 'resources,cloud_networks' }

expected = {
'resources' => a_collection_including(
a_hash_including(
'type' => 'ManageIQ::Providers::Amazon::CloudManager',
'cloud_networks' => a_collection_including
'cloud_networks' => a_collection_including(
a_hash_including('id' => cloud_network_1.id.to_s),
a_hash_including('id' => cloud_network_2.id.to_s)
)
),
a_hash_including(
'type' => 'ManageIQ::Providers::Openshift::ContainerManager'
Expand Down

0 comments on commit c195eab

Please sign in to comment.