Sha256: 33cba79eaee46da158f3d144d7073bea9677d3437cdfe5038126fb9a9da3b325

Contents?: true

Size: 837 Bytes

Versions: 2

Compression:

Stored size: 837 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('KT-[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

2 entries across 2 versions & 1 rubygems

Version Path
katello-foreman-engine-0.0.3 test/lib/actions/org_destroy_test.rb
katello-foreman-engine-0.0.2 test/lib/actions/org_destroy_test.rb