Sha256: 77a9de276d1403aa14b3273d2197e93648dea8c6a734f716316b100832dc1a4f

Contents?: true

Size: 1.51 KB

Versions: 34

Compression:

Stored size: 1.51 KB

Contents

require 'test_plugin_helper'
require 'foreman_tasks/test_helpers'

class UploadReportJobTest < ActiveSupport::TestCase
  include ForemanTasks::TestHelpers::WithInThreadExecutor
  include FolderIsolation

  test 'returns aborted state when disconnected' do
    organization = FactoryBot.create(:organization)
    Organization.any_instance.stubs(:owner_details).returns(
      'upstreamConsumer' => {
        'idCert' => 'TEST_CERT',
      }
    )
    ForemanInventoryUpload::Async::UploadReportJob.any_instance.expects(:content_disconnected?).returns(true)

    ForemanTasks.sync_task(ForemanInventoryUpload::Async::UploadReportJob, '', organization.id)

    label = ForemanInventoryUpload::Async::UploadReportJob.output_label(organization.id)
    progress_output = ForemanInventoryUpload::Async::ProgressOutput.get(label)
    assert_match(/Upload was stopped/, progress_output.full_output)
    assert_match(/exit 1/, progress_output.status)
  end

  test 'returns aborted state when no certificate defined on organization' do
    organization = FactoryBot.create(:organization)
    Organization.any_instance.expects(:owner_details).returns(nil)

    ForemanTasks.sync_task(ForemanInventoryUpload::Async::UploadReportJob, '', organization.id)

    label = ForemanInventoryUpload::Async::UploadReportJob.output_label(organization.id)
    progress_output = ForemanInventoryUpload::Async::ProgressOutput.get(label)
    assert_match(/Skipping organization/, progress_output.full_output)
    assert_match(/exit 1/, progress_output.status)
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
foreman_rh_cloud-11.1.0 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-10.0.3 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-11.0.3 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-9.0.59 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-11.0.2 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-11.0.1 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-11.0.0 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-9.0.58 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-10.0.2 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-9.0.57 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-10.0.1 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-9.0.56 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-9.0.55 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-9.0.54 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-9.0.53 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-9.0.52 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-8.0.52 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-9.0.51 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-8.0.51 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-7.0.48 test/jobs/upload_report_job_test.rb