Sha256: 3c6b6a7e3002f1fddaffc1eea3cebd86d43dd460781e6cae606e249ac849b716

Contents?: true

Size: 1.73 KB

Versions: 8

Compression:

Stored size: 1.73 KB

Contents

ENV['TEST_API_VERSION'] = '1.17'

require File.join(Gem.loaded_specs['hammer_cli_foreman'].full_gem_path, 'test/unit/test_helper')
require File.join(Gem.loaded_specs['hammer_cli_foreman'].full_gem_path, 'test/unit/apipie_resource_mock')
require 'hammer_cli_foreman_remote_execution/template_input'

describe HammerCLIForemanRemoteExecution::TemplateInput do
  include CommandTestHelper

  context 'ListCommand' do
    let(:cmd) { HammerCLIForemanRemoteExecution::TemplateInput::ListCommand.new('', ctx) }

    context 'output' do
      with_params ['--template-id=1'] do
        let(:expected_record_count) { cmd.resource.call(:index, :template_id => 1)['results'].length }
        it_should_print_n_records
        it_should_print_columns ['ID', 'Name', 'Input type']
      end
    end
  end

  context 'InfoCommand' do
    let(:cmd) { HammerCLIForemanRemoteExecution::TemplateInput::InfoCommand.new('', ctx) }

    context 'parameters' do
      it_should_accept 'required parameters', ['--template-id=template', '--name=foo']
    end

    context 'output' do
      with_params ['--template-id=1', '--id=1'] do
        it_should_print_columns ['ID', 'Name', 'Input type', 'Fact name', 'Variable name', 'Puppet parameter name']
      end
    end
  end

  context 'DeleteCommand' do
    let(:cmd) { HammerCLIForemanRemoteExecution::TemplateInput::DeleteCommand.new('', ctx) }

    context 'parameters' do
      it_should_accept 'required parameters', ['--template-id=template', '--name=foo']
    end
  end

  context 'CreateCommand' do
    let(:cmd) { HammerCLIForemanRemoteExecution::TemplateInput::CreateCommand.new('', ctx) }

    context 'parameters' do
      it_should_accept 'create options', ['--template-id=1', "--name=asdf", '--input-type=user']
    end
  end
end

Version data entries

8 entries across 7 versions & 1 rubygems

Version Path
hammer_cli_foreman_remote_execution-0.2.3 test/unit/foreign_input_set_test.rb
hammer_cli_foreman_remote_execution-0.2.2 test/unit/foreign_input_set_test.rb
hammer_cli_foreman_remote_execution-0.2.1 test/unit/foreign_input_set_test.rb
hammer_cli_foreman_remote_execution-0.2.0 test/unit/foreign_input_set_test.rb
hammer_cli_foreman_remote_execution-0.1.2 test/unit/foreign_input_set_test.rb
hammer_cli_foreman_remote_execution-0.1.1 test/unit/foreign_input_set_test.rb
hammer_cli_foreman_remote_execution-0.1.0 test/unit/foreign_input_set_test.rb
hammer_cli_foreman_remote_execution-0.1.0 test/unit/template_input_test.rb