Sha256: 3cee1d0f627e8cb2aac8aac4fd11ff17d064ff7eb87dccdd246e06bc38970fbc

Contents?: true

Size: 832 Bytes

Versions: 4

Compression:

Stored size: 832 Bytes

Contents

require 'test_helper'

module KatelloForemanEngine
  module Actions
    class OrgDestroyTest < ActiveSupport::TestCase

      test "runs only when the org is present in Foreman" do
        foreman_org = { 'organization' => { 'id' => '123' } }
        Bindings.expects(:organization_find).with('test').returns(foreman_org)
        step = run_steps(OrgDestroy, {'label' => 'test'}, nil).first
        assert_equal OrgDestroy, step.action_class
        assert_equal step.input['foreman_id'], '123'

        Bindings.expects(:organization_find).returns(nil)
        assert_equal [], run_steps(OrgDestroy, {'label' => 'test'}, nil)
      end

      test 'calls bindings to destroy organization' do
        Bindings.expects(:organization_destroy).with('123')
        OrgDestroy.new('foreman_id' => '123').run
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
katello-foreman-engine-0.0.12 test/lib/actions/org_destroy_test.rb
katello-foreman-engine-0.0.11 test/lib/actions/org_destroy_test.rb
katello-foreman-engine-0.0.7 test/lib/actions/org_destroy_test.rb
katello-foreman-engine-0.0.6 test/lib/actions/org_destroy_test.rb