Sha256: 35d5041699c3fc8d3f6e2749b8f18df9df12f750c8254a39e96abcba765bd112

Contents?: true

Size: 963 Bytes

Versions: 1

Compression:

Stored size: 963 Bytes

Contents

require 'test_helper'

module KatelloForemanEngine
  module Actions
    class EnvCreateTest < ActiveSupport::TestCase

      test "doesn't run for library" do
        org = Organization.new(:label => 'org')
        env = KTEnvironment.new(:label => 'dev')
        env.organization = org

        env.library = false
        plan = prepare_plan(EnvCreate, {}, env)
        step = plan.run_steps.first
        assert_equal EnvCreate, step.action_class
        assert_equal step.input['org_label'], 'org'
        assert_equal step.input['label'], 'dev'
        assert_equal step.input['cv_id'], 'env'

        env.library = true
        plan = prepare_plan(EnvCreate, {}, env)
        assert_equal [], plan.run_steps
      end

      test 'calls bindings to create environment' do
        Bindings.expects(:environment_create).with('env', 'org', 'dev')
        EnvCreate.new('org_label' => 'org', 'label' => 'dev', 'cv_id' => 'env').run
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
katello-foreman-engine-0.0.1 test/lib/actions/env_create.rb