Skip to content

Commit

Permalink
Refs #37140 - fix some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremylenz committed Feb 5, 2024
1 parent 1f12933 commit 2d9c7dc
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 19 deletions.
4 changes: 1 addition & 3 deletions app/controllers/katello/api/v2/organizations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,9 @@ def update
param :organization, Hash do
param :label, String, :required => false
end
param :simple_content_access, :bool, :desc => N_('Whether to turn on Simple Content Access for the organization.'), :required => false, :default => true, deprecated: true
def create
@organization = Organization.new(resource_params)
sca = params.key?(:simple_content_access) ? ::Foreman::Cast.to_bool(params[:simple_content_access]) : true
creator = ::Katello::OrganizationCreator.new(@organization, sca: sca)
creator = ::Katello::OrganizationCreator.new(@organization)
creator.create!
@organization.reload
# @taxonomy instance variable is necessary for foreman side
Expand Down
16 changes: 0 additions & 16 deletions test/services/katello/organization_creator_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,22 +53,6 @@ def test_create
validate_creator(creator)
end

def test_create_with_sca_off
org = FactoryBot.build(:organization)
creator = Katello::OrganizationCreator.new(org, sca: false)

Katello::Ping.expects(:ping!).returns(true)
org.expects(:candlepin_owner_exists?).returns(false)
Katello::Resources::Candlepin::Owner.expects(:create).with(org.name, org.name, content_access_mode: 'entitlement').returns(true)
Katello::Resources::Candlepin::Owner.expects(:get_ueber_cert).returns(true)
Katello::ContentViewEnvironment.any_instance.expects(:exists_in_candlepin?).returns(false)
Katello::Resources::Candlepin::Environment.expects(:create).returns(true)

creator.create!
validate_org(org)
validate_creator(creator)
end

def test_create_rollback
org = FactoryBot.build(:organization, name: 'rollback_org')
creator = Katello::OrganizationCreator.new(org)
Expand Down

0 comments on commit 2d9c7dc

Please sign in to comment.