Sha256: 4dda46f893e36a4f881c09505b2146c9b0d1cefa565e3fcd0f9deef82a008df7

Contents?: true

Size: 1.24 KB

Versions: 32

Compression:

Stored size: 1.24 KB

Contents

require 'test_plugin_helper'

class UploadsSettingsControllerTest < ActionController::TestCase
  tests ForemanInventoryUpload::UploadsSettingsController

  test 'should get upload inventory settings' do
    FactoryBot.create(:setting, :name => 'allow_auto_inventory_upload', :settings_type => "boolean", :category => "Setting::RhCloud", :default => false, :value => true)

    assert_equal true, Setting[:allow_auto_inventory_upload]

    get :index, session: set_session_user

    assert_response :success
    actual = JSON.parse(response.body)
    assert_equal true, actual['autoUploadEnabled']
    assert_equal true, Setting[:allow_auto_inventory_upload]
  end

  test 'should update allow_auto_inventory_upload setting' do
    FactoryBot.create(:setting, :name => 'allow_auto_inventory_upload', :settings_type => "boolean", :category => "Setting::RhCloud", :default => false, :value => false)

    assert_equal false, Setting[:allow_auto_inventory_upload]

    post :set_advanced_setting, params: { setting: :allow_auto_inventory_upload, value: true }, session: set_session_user

    assert_response :success
    actual = JSON.parse(response.body)
    assert_equal true, actual['autoUploadEnabled']
    assert_equal true, Setting[:allow_auto_inventory_upload]
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
foreman_rh_cloud-4.0.36 test/controllers/uploads_settings_controller_test.rb
foreman_rh_cloud-3.0.33 test/controllers/uploads_settings_controller_test.rb
foreman_rh_cloud-4.0.35 test/controllers/uploads_settings_controller_test.rb
foreman_rh_cloud-3.0.32 test/controllers/uploads_settings_controller_test.rb
foreman_rh_cloud-4.0.32 test/controllers/uploads_settings_controller_test.rb
foreman_rh_cloud-4.0.31 test/controllers/uploads_settings_controller_test.rb
foreman_rh_cloud-4.0.30 test/controllers/uploads_settings_controller_test.rb
foreman_rh_cloud-3.0.29 test/controllers/uploads_settings_controller_test.rb
foreman_rh_cloud-4.0.29 test/controllers/uploads_settings_controller_test.rb
foreman_rh_cloud-3.0.28 test/controllers/uploads_settings_controller_test.rb
foreman_rh_cloud-5.0.28 test/controllers/uploads_settings_controller_test.rb
foreman_rh_cloud-4.0.27 test/controllers/uploads_settings_controller_test.rb
foreman_rh_cloud-3.0.26 test/controllers/uploads_settings_controller_test.rb
foreman_rh_cloud-4.0.26 test/controllers/uploads_settings_controller_test.rb
foreman_rh_cloud-4.0.25.1 test/controllers/uploads_settings_controller_test.rb
foreman_rh_cloud-3.0.25 test/controllers/uploads_settings_controller_test.rb
foreman_rh_cloud-4.0.25 test/controllers/uploads_settings_controller_test.rb
foreman_rh_cloud-3.0.24.1 test/controllers/uploads_settings_controller_test.rb
foreman_rh_cloud-4.0.24.1 test/controllers/uploads_settings_controller_test.rb
foreman_rh_cloud-3.0.24 test/controllers/uploads_settings_controller_test.rb