hammer_cli_foreman_remote_execution 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ Test
@@ -0,0 +1,51 @@
1
+ ENV['TEST_API_VERSION'] = '1.10'
2
+
3
+ require File.join(Gem.loaded_specs['hammer_cli_foreman'].full_gem_path, 'test/unit/test_helper')
4
+ require File.join(Gem.loaded_specs['hammer_cli_foreman'].full_gem_path, 'test/unit/apipie_resource_mock')
5
+ require 'hammer_cli_foreman_remote_execution'
6
+
7
+ describe HammerCLIForemanRemoteExecution::JobInvocation do
8
+ include CommandTestHelper
9
+
10
+ context 'ListCommand' do
11
+ let(:cmd) { HammerCLIForemanRemoteExecution::JobInvocation::ListCommand.new('', ctx) }
12
+
13
+ context 'parameters' do
14
+ it_should_accept 'no arguments'
15
+ it_should_accept_search_params
16
+ end
17
+
18
+ context 'output' do
19
+ let(:expected_record_count) { cmd.resource.call(:index)['results'].length }
20
+ it_should_print_n_records
21
+ it_should_print_columns ['Id', 'Name', 'Task State']
22
+ end
23
+ end
24
+
25
+ context 'InfoCommand' do
26
+ let(:cmd) { HammerCLIForemanRemoteExecution::JobInvocation::InfoCommand.new('', ctx) }
27
+
28
+ before :each do
29
+ cmd.stubs(:get_parameters).returns([])
30
+ end
31
+
32
+ context 'parameters' do
33
+ it_should_accept 'id', ['--id=1']
34
+ it_should_accept 'name', ['--name=template']
35
+ end
36
+
37
+ context 'output' do
38
+ with_params ['--id=1'] do
39
+ it_should_print_columns ['Id', 'Name', 'Task State', 'Hosts']
40
+ end
41
+ end
42
+ end
43
+
44
+ context 'CreateCommand' do
45
+ let(:cmd) { HammerCLIForemanRemoteExecution::JobInvocation::CreateCommand.new('', ctx) }
46
+
47
+ context 'parameters' do
48
+ it_should_accept 'create options', ['--job-name=Run Command','--inputs=command=foo', '--search-query=name ~ example', '--async']
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,79 @@
1
+ ENV['TEST_API_VERSION'] = '1.10'
2
+
3
+ require File.join(Gem.loaded_specs['hammer_cli_foreman'].full_gem_path, 'test/unit/test_helper')
4
+ require File.join(Gem.loaded_specs['hammer_cli_foreman'].full_gem_path, 'test/unit/apipie_resource_mock')
5
+ require 'hammer_cli_foreman_remote_execution/job_template'
6
+
7
+ describe HammerCLIForemanRemoteExecution::JobTemplate do
8
+ include CommandTestHelper
9
+
10
+ context 'ListCommand' do
11
+ let(:cmd) { HammerCLIForemanRemoteExecution::JobTemplate::ListCommand.new('', ctx) }
12
+
13
+ context 'parameters' do
14
+ it_should_accept 'no arguments'
15
+ it_should_accept_search_params
16
+ end
17
+
18
+ context 'output' do
19
+ let(:expected_record_count) { cmd.resource.call(:index)['results'].length }
20
+ it_should_print_n_records
21
+ it_should_print_columns ['Id', 'Name', 'Job Name', 'Provider', 'Type']
22
+ end
23
+ end
24
+
25
+ context 'InfoCommand' do
26
+ let(:cmd) { HammerCLIForemanRemoteExecution::JobTemplate::InfoCommand.new('', ctx) }
27
+
28
+ before :each do
29
+ cmd.stubs(:get_parameters).returns([])
30
+ end
31
+
32
+ context 'parameters' do
33
+ it_should_accept 'id', ['--id=1']
34
+ it_should_accept 'name', ['--name=template']
35
+ end
36
+
37
+ context 'output' do
38
+ with_params ['--id=1'] do
39
+ it_should_print_columns ['Id', 'Name', 'Job Name', 'Provider', 'Type']
40
+ end
41
+ end
42
+ end
43
+
44
+ context 'DumpCommand' do
45
+ let(:cmd) { HammerCLIForemanRemoteExecution::JobTemplate::DumpCommand.new('', ctx) }
46
+
47
+ context 'parameters' do
48
+ it_should_accept 'id', ['--id=1']
49
+ it_should_accept 'name', ['--name=template']
50
+ end
51
+
52
+ context 'output' do
53
+ it 'must dump template' do
54
+ cmd.stubs(:context).returns(ctx.update(:adapter => :test))
55
+ out, _err = capture_io do
56
+ cmd.run(['--id=1'])
57
+ end
58
+ out.must_match(/id/)
59
+ end
60
+ end
61
+ end
62
+
63
+ context 'DeleteCommand' do
64
+ let(:cmd) { HammerCLIForemanRemoteExecution::JobTemplate::DeleteCommand.new('', ctx) }
65
+
66
+ context 'parameters' do
67
+ it_should_accept 'name', ['--name=template']
68
+ it_should_accept 'id', ['--id=1']
69
+ end
70
+ end
71
+
72
+ context 'CreateCommand' do
73
+ let(:cmd) { HammerCLIForemanRemoteExecution::JobTemplate::CreateCommand.new('', ctx) }
74
+
75
+ context 'parameters' do
76
+ it_should_accept 'create options', ['--name=Test', "--file=#{File.join(File.dirname(__FILE__), 'data', 'template.txt')}", '--job-name=Install', '--provider-type=Ssh']
77
+ end
78
+ end
79
+ end
@@ -0,0 +1,51 @@
1
+ ENV['TEST_API_VERSION'] = '1.10'
2
+
3
+ require File.join(Gem.loaded_specs['hammer_cli_foreman'].full_gem_path, 'test/unit/test_helper')
4
+ require File.join(Gem.loaded_specs['hammer_cli_foreman'].full_gem_path, 'test/unit/apipie_resource_mock')
5
+ require 'hammer_cli_foreman_remote_execution/template_input'
6
+
7
+ describe HammerCLIForemanRemoteExecution::TemplateInput do
8
+ include CommandTestHelper
9
+
10
+ context 'ListCommand' do
11
+ let(:cmd) { HammerCLIForemanRemoteExecution::TemplateInput::ListCommand.new('', ctx) }
12
+
13
+ context 'output' do
14
+ with_params ['--template-id=1'] do
15
+ let(:expected_record_count) { cmd.resource.call(:index, :template_id => 1)['results'].length }
16
+ it_should_print_n_records
17
+ it_should_print_columns ['Id', 'Name', 'Input type']
18
+ end
19
+ end
20
+ end
21
+
22
+ context 'InfoCommand' do
23
+ let(:cmd) { HammerCLIForemanRemoteExecution::TemplateInput::InfoCommand.new('', ctx) }
24
+
25
+ context 'parameters' do
26
+ it_should_accept 'required parameters', ['--template-id=template', '--name=foo']
27
+ end
28
+
29
+ context 'output' do
30
+ with_params ['--template-id=1', '--id=1'] do
31
+ it_should_print_columns ['Id', 'Name', 'Input type', 'Fact name', 'Variable name', 'Puppet parameter name']
32
+ end
33
+ end
34
+ end
35
+
36
+ context 'DeleteCommand' do
37
+ let(:cmd) { HammerCLIForemanRemoteExecution::TemplateInput::DeleteCommand.new('', ctx) }
38
+
39
+ context 'parameters' do
40
+ it_should_accept 'required parameters', ['--template-id=template', '--name=foo']
41
+ end
42
+ end
43
+
44
+ context 'CreateCommand' do
45
+ let(:cmd) { HammerCLIForemanRemoteExecution::TemplateInput::CreateCommand.new('', ctx) }
46
+
47
+ context 'parameters' do
48
+ it_should_accept 'create options', ['--template-id=1', "--name=asdf", '--input-type=user']
49
+ end
50
+ end
51
+ end
metadata ADDED
@@ -0,0 +1,106 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hammer_cli_foreman_remote_execution
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Foreman Remote Execution team
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-12-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: hammer_cli_foreman
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 0.1.3
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: 0.5.0
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 0.1.3
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: 0.5.0
33
+ - !ruby/object:Gem::Dependency
34
+ name: hammer_cli_foreman_tasks
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: 0.0.3
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: 0.0.3
47
+ description: CLI for the Foreman remote execution plugin
48
+ email:
49
+ - foreman-dev@googlegroups.com
50
+ executables: []
51
+ extensions: []
52
+ extra_rdoc_files:
53
+ - README.md
54
+ - LICENSE
55
+ files:
56
+ - ".gitignore"
57
+ - ".rubocop.yml"
58
+ - ".travis.yml"
59
+ - Gemfile
60
+ - LICENSE
61
+ - README.md
62
+ - Rakefile
63
+ - config/foreman_remote_execution.yml
64
+ - hammer_cli_foreman_remote_execution.gemspec
65
+ - lib/hammer_cli_foreman_remote_execution.rb
66
+ - lib/hammer_cli_foreman_remote_execution/i18n.rb
67
+ - lib/hammer_cli_foreman_remote_execution/job_invocation.rb
68
+ - lib/hammer_cli_foreman_remote_execution/job_template.rb
69
+ - lib/hammer_cli_foreman_remote_execution/options/normalizers.rb
70
+ - lib/hammer_cli_foreman_remote_execution/template_input.rb
71
+ - lib/hammer_cli_foreman_remote_execution/version.rb
72
+ - test/unit/data/1.10/foreman_api.json
73
+ - test/unit/data/template.txt
74
+ - test/unit/job_invocation_test.rb
75
+ - test/unit/job_template_test.rb
76
+ - test/unit/template_input_test.rb
77
+ homepage: http://github.com/theforeman/hammer_cli_foreman_remote_execution
78
+ licenses:
79
+ - GPL v3+
80
+ metadata: {}
81
+ post_install_message:
82
+ rdoc_options: []
83
+ require_paths:
84
+ - lib
85
+ required_ruby_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ required_rubygems_version: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ requirements: []
96
+ rubyforge_project:
97
+ rubygems_version: 2.4.8
98
+ signing_key:
99
+ specification_version: 4
100
+ summary: CLI for the Foreman remote execution plugin
101
+ test_files:
102
+ - test/unit/data/1.10/foreman_api.json
103
+ - test/unit/data/template.txt
104
+ - test/unit/job_invocation_test.rb
105
+ - test/unit/job_template_test.rb
106
+ - test/unit/template_input_test.rb