Sha256: fdbf383a5a1a8c42cb72b2fd5d019925187269a623cf3af57d72d3db2edc153f
Contents?: true
Size: 1.23 KB
Versions: 2
Compression:
Stored size: 1.23 KB
Contents
require 'test_helper' module KatelloForemanEngine module Actions class EnvDestroyTest < ActiveSupport::TestCase test "runs only when the env is present in Foreman and it's not library" do org = Organization.new(:label => 'org') env = KTEnvironment.new(:label => 'dev') env.organization = org foreman_env = { 'environment' => { 'id' => '123' } } Bindings.expects(:environment_find).with('org', 'dev'). times(2).returns(foreman_env) env.library = false step = run_steps(EnvironmentDestroy,{}, env).first assert_equal EnvironmentDestroy, step.action_class assert_equal step.input['foreman_id'], '123' env.library = true step = run_steps(EnvironmentDestroy,{}, env).first assert_equal EnvironmentDestroy, step.action_class assert_equal step.input['foreman_id'], '123' env.library = false Bindings.expects(:environment_find).returns(nil) assert_equal [], run_steps(EnvironmentDestroy,{}, env) end test 'calls bindings to destroy environment' do Bindings.expects(:environment_destroy).with('123') EnvironmentDestroy.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.7 | test/lib/actions/env_destroy_test.rb |
katello-foreman-engine-0.0.6 | test/lib/actions/env_destroy_test.rb |