Sha256: 319438fd5dffbde5154e9070167b70bbed89a7c61a49607dfafc7b52246bccc5
Contents?: true
Size: 1.12 KB
Versions: 4
Compression:
Stored size: 1.12 KB
Contents
require 'test_plugin_helper' # Tests for the Proxy Selector service class ProxySelectorTest < ActiveSupport::TestCase setup do @host = FactoryGirl.create(:host) end test 'reuses proxies already assigned to host' do mocked_scope = mock mocked_scope.expects(:with_features).with('Ansible').returns('foo') @host.expects(:smart_proxies).returns(mocked_scope) proxy_selector = ForemanAnsible::ProxySelector.new assert_equal 'foo', proxy_selector.available_proxies(@host)[:fallback] end test 'only finds proxies that are within host taxonomies' do @host.organization = taxonomies(:organization1) @ansible_proxy = FactoryGirl.create(:smart_proxy, :with_ansible, :organizations => [@host.organization]) # Unreachable proxy, because of the organizations mismatch with Host FactoryGirl.create(:smart_proxy, :with_ansible, :organizations => []) proxy_selector = ForemanAnsible::ProxySelector.new setup_user('view', 'smart_proxies') assert_equal [@ansible_proxy], proxy_selector.available_proxies(@host)[:global] end end
Version data entries
4 entries across 4 versions & 1 rubygems