Sha256: 27ed17142c9b5b957e96fb7bfc3b67108e93f82fa891365bb353578515d78f73

Contents?: true

Size: 1.11 KB

Versions: 14

Compression:

Stored size: 1.11 KB

Contents

require 'test_plugin_helper'

# Tests for the behavior of Ansible Role, currently only validations
class AnsibleProviderTest < ActiveSupport::TestCase
  describe '.proxy_command_options' do
    let(:template_invocation) { FactoryBot.create(:template_invocation) }
    let(:dummyhost) { FactoryBot.create(:host) }

    it 'adds an ansible inventory' do
      assert command_options['ansible_inventory']
    end

    context 'when it is not using the ansible_run_host feature' do
      it 'sets enables :remote_execution_command to true' do
        assert command_options[:remote_execution_command]
      end
    end

    context 'when it is using the ansible_run_host feature' do
      let(:rex_feature) do
        RemoteExecutionFeature.where(:label => 'ansible_run_host').first
      end

      it 'has remote_execution_command false' do
        template_invocation.template.remote_execution_features << rex_feature
        assert_not command_options[:remote_execution_command]
      end
    end

    def command_options
      ForemanAnsible::AnsibleProvider.
        proxy_command_options(template_invocation, dummyhost)
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
foreman_ansible-2.2.14 test/unit/ansible_provider_test.rb
foreman_ansible-2.2.13 test/unit/ansible_provider_test.rb
foreman_ansible-2.2.12 test/unit/ansible_provider_test.rb
foreman_ansible-2.2.11 test/unit/ansible_provider_test.rb
foreman_ansible-2.2.10 test/unit/ansible_provider_test.rb
foreman_ansible-2.2.9 test/unit/ansible_provider_test.rb
foreman_ansible-2.2.8 test/unit/ansible_provider_test.rb
foreman_ansible-2.2.7 test/unit/ansible_provider_test.rb
foreman_ansible-2.2.6 test/unit/ansible_provider_test.rb
foreman_ansible-2.2.5 test/unit/ansible_provider_test.rb
foreman_ansible-2.2.4 test/unit/ansible_provider_test.rb
foreman_ansible-2.2.3 test/unit/ansible_provider_test.rb
foreman_ansible-2.2.2 test/unit/ansible_provider_test.rb
foreman_ansible-2.2.1 test/unit/ansible_provider_test.rb