Skip to content

Commit

Permalink
skip tests if multiCV not available
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremylenz authored and chris1984 committed Sep 6, 2024
1 parent 89d3252 commit 017a2eb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ class MachineTelemetriesControllerTest < ActionController::TestCase

context '#branch_info' do
setup do
UpstreamOnlySettingsTestHelper.set_if_available('allow_multiple_content_views')
User.current = User.find_by(login: 'secret_admin')
Setting[:allow_multiple_content_views] = true

@env = FactoryBot.create(:katello_k_t_environment)
@env2 = FactoryBot.create(:katello_k_t_environment, organization: @env.organization)
Expand Down
8 changes: 8 additions & 0 deletions test/test_plugin_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,11 @@ module CandlepinIsolation
end
end
end

module UpstreamOnlySettingsTestHelper
def self.set_if_available(setting_name, value: true)
Setting[setting_name] = value
rescue Foreman::Exception
skip "Setting #{setting_name} is not available in Foreman"
end
end
2 changes: 1 addition & 1 deletion test/unit/tags_generator_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ class TagsGeneratorTest < ActiveSupport::TestCase
include CandlepinIsolation

setup do
UpstreamOnlySettingsTestHelper.set_if_available('allow_multiple_content_views')
User.current = User.find_by(login: 'secret_admin')
Setting[:allow_multiple_content_views] = true

env = FactoryBot.create(:katello_k_t_environment)
env2 = FactoryBot.create(:katello_k_t_environment, organization: env.organization)
Expand Down

0 comments on commit 017a2eb

Please sign in to comment.