Sha256: ad5dcef5f51f5dccb05cedb506028c43ffca7d33311628ac0f37baf39b51085c

Contents?: true

Size: 1020 Bytes

Versions: 23

Compression:

Stored size: 1020 Bytes

Contents

require 'test_plugin_helper'
require 'foreman_tasks/test_helpers'

class InventoryScheduledSyncTest < ActiveSupport::TestCase
  include ForemanTasks::TestHelpers::WithInThreadExecutor

  test 'Schedules an execution if auto upload is enabled' do
    FactoryBot.create(:setting, :name => 'allow_auto_inventory_upload', :settings_type => "boolean", :category => "Setting::RhCloud", :default => false, :value => true)

    InventorySync::Async::InventoryScheduledSync.any_instance.expects(:plan_org_sync).times(Organization.unscoped.count)

    ForemanTasks.sync_task(InventorySync::Async::InventoryScheduledSync)
  end

  test 'Skips execution if auto upload is disabled' do
    FactoryBot.create(:setting, :name => 'allow_auto_inventory_upload', :settings_type => "boolean", :category => "Setting::RhCloud", :default => false, :value => false)

    InventorySync::Async::InventoryScheduledSync.any_instance.expects(:plan_org_sync).never

    ForemanTasks.sync_task(InventorySync::Async::InventoryScheduledSync)
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

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