Sha256: 56dcdaf9c17ce84d684c3d9ae470daa766192e86524f5b001c3ec6448db7f83e

Contents?: true

Size: 1.28 KB

Versions: 85

Compression:

Stored size: 1.28 KB

Contents

# frozen_string_literal: true

require 'test_plugin_helper'

module Api
  module V2
    class TemplateInvocationsControllerTest < ActionController::TestCase
      setup do
        @job = FactoryBot.create(:job_invocation, :with_template, :with_task)
        @template_invocation = @job.template_invocations.first
      end

      test 'should get template invocations belonging to job invocation' do
        get :template_invocations, params: { :id => @job.id }
        invocations = ActiveSupport::JSON.decode(@response.body)
        _(invocations['results'].count).must_equal @job.template_invocations.count
        _(invocations['total']).must_equal @job.template_invocations.count

        expected_result = {
          'id'                   => @template_invocation.id,
          'host_id'              => @template_invocation.host_id,
          'host_name'            => @template_invocation.host.name,
          'template_id'          => @template_invocation.template_id,
          'effective_user'       => @template_invocation.effective_user,
          'job_invocation_id'    => @job.id,
          'run_host_job_task_id' => @template_invocation.run_host_job_task_id,
        }
        _(invocations['results']).must_equal [expected_result]
        assert_response :success
      end
    end
  end
end

Version data entries

85 entries across 85 versions & 1 rubygems

Version Path
foreman_remote_execution-12.0.7 test/functional/api/v2/template_invocations_controller_test.rb
foreman_remote_execution-10.1.3 test/functional/api/v2/template_invocations_controller_test.rb
foreman_remote_execution-12.0.5 test/functional/api/v2/template_invocations_controller_test.rb
foreman_remote_execution-12.0.4 test/functional/api/v2/template_invocations_controller_test.rb
foreman_remote_execution-12.0.1 test/functional/api/v2/template_invocations_controller_test.rb
foreman_remote_execution-12.0.2 test/functional/api/v2/template_invocations_controller_test.rb
foreman_remote_execution-11.1.3 test/functional/api/v2/template_invocations_controller_test.rb
foreman_remote_execution-10.1.2 test/functional/api/v2/template_invocations_controller_test.rb
foreman_remote_execution-12.0.0 test/functional/api/v2/template_invocations_controller_test.rb
foreman_remote_execution-10.1.1 test/functional/api/v2/template_invocations_controller_test.rb
foreman_remote_execution-11.1.1 test/functional/api/v2/template_invocations_controller_test.rb
foreman_remote_execution-11.1.0 test/functional/api/v2/template_invocations_controller_test.rb
foreman_remote_execution-10.1.0 test/functional/api/v2/template_invocations_controller_test.rb
foreman_remote_execution-8.3.3 test/functional/api/v2/template_invocations_controller_test.rb
foreman_remote_execution-8.3.2 test/functional/api/v2/template_invocations_controller_test.rb
foreman_remote_execution-11.0.0 test/functional/api/v2/template_invocations_controller_test.rb
foreman_remote_execution-10.0.7 test/functional/api/v2/template_invocations_controller_test.rb
foreman_remote_execution-8.3.1 test/functional/api/v2/template_invocations_controller_test.rb
foreman_remote_execution-10.0.6 test/functional/api/v2/template_invocations_controller_test.rb
foreman_remote_execution-10.0.5 test/functional/api/v2/template_invocations_controller_test.rb