Revision 3146fd86
Added by Oleh Fedorenko over 1 year ago
test/controllers/api/v2/settings_controller_test.rb | ||
---|---|---|
end
|
||
|
||
test "should get all settings through index" do
|
||
Setting['host_power_status'] = false
|
||
Setting['append_domain_name_for_hosts'] = false
|
||
get :index, params: { per_page: 'all' }
|
||
assert_response :success
|
||
settings = ActiveSupport::JSON.decode(@response.body)['results']
|
||
... | ... | |
foreman_url = settings.detect { |s| s['name'] == 'foreman_url' }
|
||
assert_equal Setting['foreman_url'], foreman_url['value']
|
||
assert_equal Foreman.settings.find('foreman_url').default, foreman_url['default']
|
||
host_power_status = settings.detect { |s| s['name'] == 'host_power_status' }
|
||
assert_equal false, host_power_status['value']
|
||
append_domain_name_for_hosts = settings.detect { |s| s['name'] == 'append_domain_name_for_hosts' }
|
||
assert_equal false, append_domain_name_for_hosts['value']
|
||
end
|
||
|
||
test "should get index with organization and location params" do
|
||
... | ... | |
end
|
||
|
||
test "properly show overriden false value" do
|
||
Setting['host_power_status'] = value = false
|
||
get :show, params: { :id => 'host_power_status' }
|
||
Setting['append_domain_name_for_hosts'] = value = false
|
||
get :show, params: { :id => 'append_domain_name_for_hosts' }
|
||
assert_response :success
|
||
show_response = ActiveSupport::JSON.decode(@response.body)
|
||
assert_equal value, show_response['value']
|
Also available in: Unified diff
Fixes #35621 - Make power status a selectable column