Sha256: 0361ad08a3aaf7c4cbfa2a4fc10e4ad056a9a5f49d1d98300897f29314dadb20

Contents?: true

Size: 756 Bytes

Versions: 51

Compression:

Stored size: 756 Bytes

Contents

# frozen_string_literal: true

require 'test_helper'
# unit tests for ProxyAPI::Ansible
class AnsibleTest < ActiveSupport::TestCase
  setup do
    @url = 'http://localhost:8443'
    @proxy_api = ProxyAPI::Ansible.new(:url => @url)
  end

  test 'should get ansible roles from proxy' do
    roles = ['some_role.some_author', 'test_role.test_author']
    @proxy_api.expects(:get).returns(fake_rest_client_response(roles))
    assert_equal roles, @proxy_api.roles
  end

  test 'should raise error with appropriate message' do
    message = 'Connection refused'
    @proxy_api.expects(:get).raises(Errno::ECONNREFUSED, message)
    err = assert_raises ProxyAPI::ProxyException do
      @proxy_api.roles
    end
    assert_match message, err.message
  end
end

Version data entries

51 entries across 51 versions & 1 rubygems

Version Path
foreman_ansible-7.0.4 test/unit/lib/proxy_api/ansible_test.rb
foreman_ansible-7.0.3 test/unit/lib/proxy_api/ansible_test.rb
foreman_ansible-7.0.2 test/unit/lib/proxy_api/ansible_test.rb
foreman_ansible-7.0.1 test/unit/lib/proxy_api/ansible_test.rb
foreman_ansible-7.0.0 test/unit/lib/proxy_api/ansible_test.rb
foreman_ansible-6.3.4 test/unit/lib/proxy_api/ansible_test.rb
foreman_ansible-6.3.3 test/unit/lib/proxy_api/ansible_test.rb
foreman_ansible-6.3.2 test/unit/lib/proxy_api/ansible_test.rb
foreman_ansible-6.3.1 test/unit/lib/proxy_api/ansible_test.rb
foreman_ansible-6.4.1 test/unit/lib/proxy_api/ansible_test.rb
foreman_ansible-6.4.0 test/unit/lib/proxy_api/ansible_test.rb
foreman_ansible-6.3.0 test/unit/lib/proxy_api/ansible_test.rb
foreman_ansible-6.2.0 test/unit/lib/proxy_api/ansible_test.rb
foreman_ansible-6.1.1 test/unit/lib/proxy_api/ansible_test.rb
foreman_ansible-6.0.2 test/unit/lib/proxy_api/ansible_test.rb
foreman_ansible-6.1.0 test/unit/lib/proxy_api/ansible_test.rb
foreman_ansible-6.0.1 test/unit/lib/proxy_api/ansible_test.rb
foreman_ansible-5.1.3 test/unit/lib/proxy_api/ansible_test.rb
foreman_ansible-6.0.0 test/unit/lib/proxy_api/ansible_test.rb
foreman_ansible-5.1.2 test/unit/lib/proxy_api/ansible_test.rb