Skip to content

Commit

Permalink
Refs #36693 - Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremylenz committed Aug 25, 2023
1 parent 19ccfcd commit f02a7fc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion test/services/katello/registration_manager_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ def test_process_registration_new_host
def test_process_registration_existing_host
host = FactoryBot.create(:host, :with_content, :organization_id => @org.id)
@facts = {'network.hostname' => host.name}
::Host::Managed.any_instance.stubs(:refresh_statuses)

::Katello::RegistrationManager.expects(:register_host).with(host, rhsm_params, [@content_view_environment], [])

Expand Down Expand Up @@ -214,6 +215,7 @@ def test_registration
::Katello::Host::SubscriptionFacet.any_instance.expects(:update_guests).twice
::Organization.any_instance.stubs(:simple_content_access?).returns(false)

::Host::Managed.any_instance.stubs(:refresh_statuses)
::Katello::RegistrationManager.register_host(new_host, rhsm_params, [@content_view_environment])

assert_equal new_host.subscription_facet.uuid, 'fake-uuid-from-candlepin'
Expand All @@ -230,6 +232,7 @@ def test_registration_activation_key
::Katello::Resources::Candlepin::Consumer.expects(:get).once.with('fake-uuid-from-katello').returns({})
::Katello::Host::SubscriptionFacet.any_instance.expects(:update_hypervisor).twice
::Katello::Host::SubscriptionFacet.any_instance.expects(:update_guests).twice
::Host::Managed.any_instance.stubs(:refresh_statuses)

::Organization.any_instance.stubs(:simple_content_access?).returns(false)

Expand Down Expand Up @@ -266,6 +269,7 @@ def test_registration_existing_host
::Katello::Host::SubscriptionFacet.any_instance.expects(:update_hypervisor).twice
::Katello::Host::SubscriptionFacet.any_instance.expects(:update_guests).twice
::Katello::RegistrationManager.expects(:get_uuid).returns("fake-uuid-from-katello")
::Host::Managed.any_instance.stubs(:refresh_statuses)

::Katello::Resources::Candlepin::Consumer.expects(:create).with([@content_view_environment.cp_id], rhsm_params, [], @content_view.organization).returns(:uuid => 'fake-uuid-from-katello')
::Katello::Resources::Candlepin::Consumer.expects(:get).once.with('fake-uuid-from-katello').returns({})
Expand All @@ -279,7 +283,7 @@ def test_unregister_host_without_katello_agent
@host = FactoryBot.create(:host, :with_content, :with_subscription, :content_view => @content_view,
:lifecycle_environment => @library, :organization => @content_view.organization)
::Katello.expects(:with_katello_agent?).returns(false)
@host.content_facet.expects(:cves_changed?).returns(false)
::Host::Managed.any_instance.stubs(:refresh_statuses)
::Katello::Resources::Candlepin::Consumer.expects(:destroy)
::Katello::EventQueue.expects(:push_event).never
::Katello::RegistrationManager.unregister_host(@host, :unregistering => true)
Expand All @@ -293,6 +297,7 @@ def test_unregister_host_with_katello_agent
::Katello.expects(:with_katello_agent?).returns(true)
::Katello::Resources::Candlepin::Consumer.expects(:destroy)
::Katello::EventQueue.expects(:push_event)
::Host::Managed.any_instance.stubs(:refresh_statuses)

::Katello::RegistrationManager.unregister_host(@host, :unregistering => true)
end
Expand Down

0 comments on commit f02a7fc

Please sign in to comment.