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-3.0.23 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-4.0.23 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-3.0.22 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-4.0.22 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-4.0.21.1 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-3.0.21.1 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-3.0.21 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-3.0.20 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-3.0.19 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-2.0.18.1 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-3.0.18.1 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-1.0.18 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-2.0.18 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-3.0.18 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-1.0.17 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-2.0.17 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-3.0.17 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-2.0.16 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-1.0.16 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-3.0.16 test/jobs/upload_report_job_test.rb