Sha256: 85fc16aa70adbf47e7c9c23d66632955efd2d473f41d7cbbe2b0d46c208d2ddb
Contents?: true
Size: 1.83 KB
Versions: 31
Compression:
Stored size: 1.83 KB
Contents
# frozen_string_literal: true require 'test_plugin_helper' # functional tests for AnsibleVariablesController class AnsibleVariablesControllerTest < ActionController::TestCase setup do @model = FactoryBot.create(:ansible_variable) @proxy = FactoryBot.create(:smart_proxy, :with_ansible) end basic_index_test basic_edit_test @variable basic_pagination_per_page_test basic_pagination_rendered_test test 'should destroy variable' do assert_difference('AnsibleVariable.count', -1) do delete :destroy, :params => { :id => @model.id }, :session => set_session_user end assert_redirected_to ansible_variables_url end test 'there are no problems when the import hash is empty' do ForemanAnsible::VariablesImporter.any_instance. expects(:import_variable_names).returns({}) ForemanAnsible::UiRolesImporter.any_instance. expects(:import_role_names).returns({}) get :import, :params => { :proxy => @proxy.id }, :session => set_session_user assert_redirected_to ansible_variables_url end test 'should show import page' do ForemanAnsible::UiRolesImporter.any_instance. expects(:import_role_names).returns({}) ForemanAnsible::VariablesImporter.any_instance. expects(:import_variable_names).returns({ :obsolete => [@model] }) get :import, :params => { :proxy => @proxy.id }, :session => set_session_user assert_response :success end test 'should create ansible variable' do params = { :ansible_variable => { :key => 'great name', :ansible_role_id => FactoryBot.create(:ansible_role).id } } assert_difference('AnsibleVariable.count', 1) do post :create, :params => params, :session => set_session_user end assert_redirected_to ansible_variables_url end end
Version data entries
31 entries across 31 versions & 1 rubygems