Sha256: 6f0cf72d0308f24c69cd2870a4510ebc8f3f6a85eeb571f6933da3b29bd30aae

Contents?: true

Size: 1.43 KB

Versions: 4

Compression:

Stored size: 1.43 KB

Contents

require File.join(File.dirname(__FILE__), 'test_helper')

describe 'template' do
  describe 'combinations' do
    before do
      @cmd = %w[template combination]
    end

    it 'should create new combination' do
      params = ['create', '--provisioning-template-id=10', '--hostgroup-id=1', '--puppet-environment-id=1']
      expected_result = success_result("Template combination created.\n")
      api_expects(:template_combinations, :create, 'Create template combination') do |p|
        p['provisioning_template_id'] == '10' &&
          p['hostgroup_id'] == '1' &&
          p['environment_id'] == 1 &&
          p['template_combination'] == { 'environment_id' => 1, 'hostgroup_id' => '1' }
      end

      result = run_cmd(@cmd + params)
      assert_cmd(expected_result, result)
    end

    it 'should update combination' do
      params = ['update', '--id=3', '--provisioning-template-id=10', '--hostgroup-id=1', '--puppet-environment-id=1']
      expected_result = success_result("Template combination updated.\n")
      api_expects(:template_combinations, :update, 'Update template combination') do |p|
        p['id'] == '3' &&
          p['provisioning_template_id'] == '10' &&
          p['hostgroup_id'] == '1' &&
          p['environment_id'] == 1 &&
          p['template_combination'] == { 'environment_id' => 1, 'hostgroup_id' => '1' }
      end

      result = run_cmd(@cmd + params)
      assert_cmd(expected_result, result)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
hammer_cli_foreman_puppet-0.0.7 test/functional/template_test.rb
hammer_cli_foreman_puppet-0.0.6 test/functional/template_test.rb
hammer_cli_foreman_puppet-0.0.5 test/functional/template_test.rb
hammer_cli_foreman_puppet-0.0.4 test/functional/template_test.rb