Sha256: 56f787812b0c6d6390e922c7a255adac1b743bc521e1859192dd67e868c7f76f
Contents?: true
Size: 1.62 KB
Versions: 40
Compression:
Stored size: 1.62 KB
Contents
require 'test_plugin_helper' class SettingsControllerTest < ActionController::TestCase tests InsightsCloud::SettingsController test 'should return allow_auto_insights_sync setting' do Setting[:allow_auto_insights_sync] = false assert_equal false, Setting[:allow_auto_insights_sync] get :show, session: set_session_user assert_response :success actual = JSON.parse(response.body) assert_equal false, actual['insightsSyncEnabled'] end test 'should update allow_auto_insights_sync setting' do Setting[:allow_auto_insights_sync] = false assert_equal false, Setting[:allow_auto_insights_sync] patch :update, params: { insightsSyncEnabled: true }, session: set_session_user assert_response :success actual = JSON.parse(response.body) assert_equal true, actual['insightsSyncEnabled'] assert_equal true, Setting[:allow_auto_insights_sync] end test 'Should update an organization parameter' do FactoryBot.create(:common_parameter, name: InsightsCloud.enable_cloud_remediations_param, value: false) host = FactoryBot.create(:host) # make sure the parameter is there assert_equal false, host.host_params[InsightsCloud.enable_cloud_remediations_param] post :set_org_parameter, params: { parameter: InsightsCloud.enable_cloud_remediations_param, value: true, organization_id: host.organization.id }, session: set_session_user # needed for properly access host_params User.as_anonymous_admin do # refresh the host record host = Host.find(host.id) assert_equal true, host.host_params[InsightsCloud.enable_cloud_remediations_param] end end end
Version data entries
40 entries across 40 versions & 1 rubygems