Sha256: 3d2ea71957b968d1938267830326739dde1c5363c0042e5491fc9cb3cd8b03b7

Contents?: true

Size: 1.36 KB

Versions: 59

Compression:

Stored size: 1.36 KB

Contents

require 'test_plugin_helper'

class UploadReportJobTest < ActiveJob::TestCase
  include FolderIsolation

  test 'returns aborted state when disconnected' do
    organization = FactoryBot.create(:organization)
    Organization.any_instance.stubs(:owner_details).returns(
      'upstreamConsumer' => {
        'idCert' => 'TEST_CERT',
      }
    )
    FactoryBot.create(:setting, :name => 'content_disconnected', :value => true)

    ForemanInventoryUpload::Async::UploadReportJob.perform_now('', 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)

    ForemanInventoryUpload::Async::UploadReportJob.perform_now('', 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

59 entries across 59 versions & 1 rubygems

Version Path
foreman_rh_cloud-4.0.36 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-3.0.33 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-4.0.35 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-3.0.32 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-4.0.32 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-4.0.31 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-4.0.30 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-3.0.29 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-4.0.29 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-3.0.28 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-4.0.27 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-3.0.26 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-4.0.26 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-4.0.25.1 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-3.0.25 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-4.0.25 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-3.0.24.1 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-4.0.24.1 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-3.0.24 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-4.0.24 test/jobs/upload_report_job_test.rb