Skip to content

Commit 017a2eb

Browse files
jeremylenzchris1984
authored andcommitted
skip tests if multiCV not available
1 parent 89d3252 commit 017a2eb

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

test/controllers/insights_cloud/api/machine_telemetries_controller_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ class MachineTelemetriesControllerTest < ActionController::TestCase
107107

108108
context '#branch_info' do
109109
setup do
110+
UpstreamOnlySettingsTestHelper.set_if_available('allow_multiple_content_views')
110111
User.current = User.find_by(login: 'secret_admin')
111-
Setting[:allow_multiple_content_views] = true
112112

113113
@env = FactoryBot.create(:katello_k_t_environment)
114114
@env2 = FactoryBot.create(:katello_k_t_environment, organization: @env.organization)

test/test_plugin_helper.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,3 +117,11 @@ module CandlepinIsolation
117117
end
118118
end
119119
end
120+
121+
module UpstreamOnlySettingsTestHelper
122+
def self.set_if_available(setting_name, value: true)
123+
Setting[setting_name] = value
124+
rescue Foreman::Exception
125+
skip "Setting #{setting_name} is not available in Foreman"
126+
end
127+
end

test/unit/tags_generator_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ class TagsGeneratorTest < ActiveSupport::TestCase
55
include CandlepinIsolation
66

77
setup do
8+
UpstreamOnlySettingsTestHelper.set_if_available('allow_multiple_content_views')
89
User.current = User.find_by(login: 'secret_admin')
9-
Setting[:allow_multiple_content_views] = true
1010

1111
env = FactoryBot.create(:katello_k_t_environment)
1212
env2 = FactoryBot.create(:katello_k_t_environment, organization: env.organization)

0 commit comments

Comments
 (0)