Sha256: f89da11e25869e52af73cf5f3eafbc85a8923cc366f5cbc46a7e0021d51c5c61

Contents?: true

Size: 1.43 KB

Versions: 62

Compression:

Stored size: 1.43 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 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

62 entries across 62 versions & 1 rubygems

Version Path
foreman_ansible-14.2.2 test/functional/ansible_variables_controller_test.rb
foreman_ansible-14.2.1 test/functional/ansible_variables_controller_test.rb
foreman_ansible-13.0.7 test/functional/ansible_variables_controller_test.rb
foreman_ansible-14.2.0 test/functional/ansible_variables_controller_test.rb
foreman_ansible-14.1.1 test/functional/ansible_variables_controller_test.rb
foreman_ansible-14.1.0 test/functional/ansible_variables_controller_test.rb
foreman_ansible-13.0.5 test/functional/ansible_variables_controller_test.rb
foreman_ansible-14.0.0 test/functional/ansible_variables_controller_test.rb
foreman_ansible-13.0.4 test/functional/ansible_variables_controller_test.rb
foreman_ansible-13.0.3 test/functional/ansible_variables_controller_test.rb
foreman_ansible-13.0.2 test/functional/ansible_variables_controller_test.rb
foreman_ansible-13.0.1 test/functional/ansible_variables_controller_test.rb
foreman_ansible-13.0.0 test/functional/ansible_variables_controller_test.rb
foreman_ansible-12.0.7 test/functional/ansible_variables_controller_test.rb
foreman_ansible-10.4.4 test/functional/ansible_variables_controller_test.rb
foreman_ansible-7.1.8 test/functional/ansible_variables_controller_test.rb
foreman_ansible-12.0.6 test/functional/ansible_variables_controller_test.rb
foreman_ansible-12.0.5 test/functional/ansible_variables_controller_test.rb
foreman_ansible-10.4.3 test/functional/ansible_variables_controller_test.rb
foreman_ansible-12.0.4 test/functional/ansible_variables_controller_test.rb