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-1.0.15 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-2.0.15 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-3.0.15 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-3.0.14 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-2.0.14 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-1.0.14 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-0.9.14 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-0.9.13.1 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-1.0.13.1 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-2.0.13.1 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-0.9.13 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-1.0.13 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-2.0.13 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-0.9.12 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-1.0.12 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-2.0.12 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-0.9.11 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-1.0.11 test/jobs/upload_report_job_test.rb
foreman_rh_cloud-2.0.11 test/jobs/upload_report_job_test.rb