Sha256: b995a0201e6f2a5fb72becc058329cc6672cdea7cafe0ad5d5123bd08f8ad08c
Contents?: true
Size: 1.25 KB
Versions: 6
Compression:
Stored size: 1.25 KB
Contents
require "test_plugin_helper" module ForemanRemoteExecution class RunHostsJobTest < ActiveSupport::TestCase include Dynflow::Testing let(:proxy) { FactoryGirl.build(:smart_proxy) } let(:hostname) { 'myhost.example.com' } let(:script) { 'ping -c 5 redhat.com' } let(:targeting) { FactoryGirl.create(:targeting, :search_query => "name = #{host.name}", :user => User.current) } let(:job_invocation) do FactoryGirl.build(:job_invocation).tap do |invocation| invocation.targeting = targeting invocation.save end end let(:host) { FactoryGirl.create(:host) } let(:action) do action = create_action(Actions::RemoteExecution::RunHostsJob) action.expects(:action_subject).with(job_invocation) action.expects(:task).returns(OpenStruct.new(:id => '123')) plan_action(action, job_invocation) end before do User.current = users :admin action end it 'resolves the hosts on targeting in plan phase' do targeting.hosts.must_include(host) end it 'triggers the RunHostJob actions on the resolved hosts in run phase' do action.expects(:trigger).with(Actions::RemoteExecution::RunHostJob, job_invocation, host) action.create_sub_plans end end end
Version data entries
6 entries across 6 versions & 1 rubygems