Sha256: 7f004f847b5d692f84a880c0560ad5c23f6ddd4e64d15694daecb45b3a62f202

Contents?: true

Size: 1.01 KB

Versions: 12

Compression:

Stored size: 1.01 KB

Contents

require_relative '../../../test_plugin_helper'

class Api::V2::SettingsControllerTest < ActionController::TestCase
  setup do
    FactoryBot.create(:setting, :name => 'discovery_prefix', :value => 'mac', :category => 'Setting::Discovered')
  end

  test_attributes :pid => '2c5ecb7e-87bc-4980-9620-7ae00e3f360e'
  test "should update hostname prefix without value" do
    setting = Setting.find_by_name("discovery_prefix")
    put :update, params: { :id => setting.id, :setting => { :value => '' } }
    assert_equal JSON.parse(@response.body)['value'], '', "Can't update discovery_prefix setting with empty value"
  end

  test_attributes :pid => '4969994d-f934-4f0e-9a98-476b87eb0527'
  test "should update hostname prefix" do
    value = RFauxFactory.gen_alpha
    setting = Setting.find_by_name("discovery_prefix")
    put :update, params: { :id => setting.id, :setting => { :value => value } }
    assert_equal JSON.parse(@response.body)['value'], value, "Can't update discovery_prefix setting with valid value #{value}"
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
foreman_discovery-16.1.4 test/functional/api/v2/settings_controller_test.rb
foreman_discovery-16.1.3 test/functional/api/v2/settings_controller_test.rb
foreman_discovery-16.1.2 test/functional/api/v2/settings_controller_test.rb
foreman_discovery-16.1.0 test/functional/api/v2/settings_controller_test.rb
foreman_discovery-16.0.1 test/functional/api/v2/settings_controller_test.rb
foreman_discovery-16.0.0 test/functional/api/v2/settings_controller_test.rb
foreman_discovery-15.1.0 test/functional/api/v2/settings_controller_test.rb
foreman_discovery-15.0.2 test/functional/api/v2/settings_controller_test.rb
foreman_discovery-15.0.1 test/functional/api/v2/settings_controller_test.rb
foreman_discovery-15.0.0 test/functional/api/v2/settings_controller_test.rb
foreman_discovery-14.0.1 test/functional/api/v2/settings_controller_test.rb
foreman_discovery-14.0.0 test/functional/api/v2/settings_controller_test.rb