vsphere-automation-runtime 0.4.5 → 0.4.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +20 -0
  3. data/lib/vsphere-automation-runtime/version.rb +1 -1
  4. metadata +4 -43
  5. data/Gemfile +0 -12
  6. data/Gemfile.lock +0 -71
  7. data/README.md +0 -44
  8. data/Rakefile +0 -18
  9. data/coverage/.last_run.json +0 -5
  10. data/coverage/.resultset.json +0 -828
  11. data/coverage/.resultset.json.lock +0 -0
  12. data/coverage/assets/0.10.2/application.css +0 -799
  13. data/coverage/assets/0.10.2/application.js +0 -1707
  14. data/coverage/assets/0.10.2/colorbox/border.png +0 -0
  15. data/coverage/assets/0.10.2/colorbox/controls.png +0 -0
  16. data/coverage/assets/0.10.2/colorbox/loading.gif +0 -0
  17. data/coverage/assets/0.10.2/colorbox/loading_background.png +0 -0
  18. data/coverage/assets/0.10.2/favicon_green.png +0 -0
  19. data/coverage/assets/0.10.2/favicon_red.png +0 -0
  20. data/coverage/assets/0.10.2/favicon_yellow.png +0 -0
  21. data/coverage/assets/0.10.2/loading.gif +0 -0
  22. data/coverage/assets/0.10.2/magnify.png +0 -0
  23. data/coverage/assets/0.10.2/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  24. data/coverage/assets/0.10.2/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  25. data/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  26. data/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  27. data/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  28. data/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  29. data/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  30. data/coverage/assets/0.10.2/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  31. data/coverage/assets/0.10.2/smoothness/images/ui-icons_222222_256x240.png +0 -0
  32. data/coverage/assets/0.10.2/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
  33. data/coverage/assets/0.10.2/smoothness/images/ui-icons_454545_256x240.png +0 -0
  34. data/coverage/assets/0.10.2/smoothness/images/ui-icons_888888_256x240.png +0 -0
  35. data/coverage/assets/0.10.2/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
  36. data/coverage/index.html +0 -5100
  37. data/git_push.sh +0 -55
  38. data/spec/api_client_spec.rb +0 -248
  39. data/spec/configuration_spec.rb +0 -38
  40. data/spec/spec_helper.rb +0 -110
  41. data/vsphere-automation-runtime.gemspec +0 -38
@@ -1,55 +0,0 @@
1
- #!/bin/sh
2
- #
3
- # Generated by: https://openapi-generator.tech
4
- #
5
- # ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
6
- #
7
- # Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update"
8
-
9
- git_user_id=$1
10
- git_repo_id=$2
11
- release_note=$3
12
-
13
- if [ "$git_user_id" = "" ]; then
14
- git_user_id="GIT_USER_ID"
15
- echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
16
- fi
17
-
18
- if [ "$git_repo_id" = "" ]; then
19
- git_repo_id="GIT_REPO_ID"
20
- echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
21
- fi
22
-
23
- if [ "$release_note" = "" ]; then
24
- release_note="Minor update"
25
- echo "[INFO] No command line input provided. Set \$release_note to $release_note"
26
- fi
27
-
28
- # Initialize the local directory as a Git repository
29
- git init
30
-
31
- # Adds the files in the local repository and stages them for commit.
32
- git add .
33
-
34
- # Commits the tracked changes and prepares them to be pushed to a remote repository.
35
- git commit -m "$release_note"
36
-
37
- # Sets the new remote
38
- git_remote=`git remote`
39
- if [ "$git_remote" = "" ]; then # git remote not defined
40
-
41
- if [ "$GIT_TOKEN" = "" ]; then
42
- echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
43
- git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
44
- else
45
- git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
46
- fi
47
-
48
- fi
49
-
50
- git pull origin master
51
-
52
- # Pushes (Forces) the changes in the local repository up to the remote repository
53
- echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
54
- git push origin master 2>&1 | grep -v 'To https'
55
-
@@ -1,248 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe VSphereAutomation::ApiClient do
4
- describe '.default' do
5
- it 'returns the same instance every time' do
6
- first_instance = VSphereAutomation::ApiClient.default
7
- second_instance = VSphereAutomation::ApiClient.default
8
- third_instance = VSphereAutomation::ApiClient.default
9
- expect(first_instance).to be(second_instance)
10
- expect(first_instance).to be(third_instance)
11
- end
12
- end
13
-
14
- describe '#build_collection_param' do
15
- context 'when called with format :multi' do
16
- it 'returns the collection' do
17
- params = { foo: 'bar', baz: 'quux' }
18
- expect(subject.build_collection_param(params, :multi)).to eq(params)
19
- end
20
- end
21
- end
22
-
23
- describe '#call_api' do
24
- let(:host) { 'example.com' }
25
- let(:config) do
26
- VSphereAutomation::Configuration.new.tap do |c|
27
- c.scheme = 'https'
28
- c.host = host
29
- end
30
- end
31
- let(:url) { 'https://example.com/rest/test' }
32
- subject { VSphereAutomation::ApiClient.new(config) }
33
-
34
- it 'adds headers to request' do
35
- headers = { 'foo' => 'bar' }
36
- stub_request(:get, url).with(headers: headers)
37
-
38
- subject.call_api(:GET, '/test', header_params: headers)
39
-
40
- expect(a_request(:get, url).with(headers: headers)).to have_been_made
41
- end
42
-
43
- it 'adds query parameters to request' do
44
- query_params = { 'foo' => 'bar' }
45
- stub_request(:get, url).with(query: query_params)
46
-
47
- subject.call_api(:GET, '/test', query_params: query_params)
48
-
49
- expect(a_request(:get, url).with(query: query_params)).to have_been_made
50
- end
51
-
52
- it 'keeps query parameters from the path to request' do
53
- # The specs have some paths that contain query parameters already. This
54
- # test is to make sure they don't get overwritten.
55
- key = '~foo'
56
- value = 'bar'
57
- query_params = { key => value }
58
- stub_request(:post, url).with(query: query_params)
59
-
60
- subject.call_api(:POST, "/test?#{key}=#{value}")
61
-
62
- expect(a_request(:post, url).with(query: query_params)).to have_been_made
63
- end
64
-
65
- it 'adds form parameters to the request body' do
66
- form_params = { 'foo' => 'bar' }
67
- body = form_params.to_a.map { |e| e.join('=') }.join('&')
68
- stub_request(:get, url).with(body: body)
69
-
70
- subject.call_api(:GET, '/test', form_params: form_params)
71
-
72
- expect(a_request(:get, url).with(body: body)).to have_been_made
73
- end
74
-
75
- it 'uses basic auth information from configuration' do
76
- auth_name = 'basic_auth'
77
- auth_header = { config.auth_settings[auth_name][:key] =>
78
- config.auth_settings[auth_name][:value] }
79
- stub_request(:get, url).with(headers: auth_header)
80
-
81
- subject.call_api(:GET, '/test', auth_names: [auth_name])
82
-
83
- expect(a_request(:get, url)
84
- .with(headers: auth_header)).to have_been_made
85
- end
86
-
87
- it 'use API key information from configuration' do
88
- auth_name = 'api_key'
89
- config.api_key[config.auth_settings[auth_name][:key]] = 'foo'
90
- auth_header = { config.auth_settings[auth_name][:key] =>
91
- config.auth_settings[auth_name][:value] }
92
- stub_request(:get, url).with(headers: auth_header)
93
-
94
- subject.call_api(:GET, '/test', auth_names: [auth_name])
95
-
96
- expect(a_request(:get, url)
97
- .with(headers: auth_header)).to have_been_made
98
- end
99
-
100
- it 'updates api_key from responses with set-cookie header' do
101
- key = config.auth_settings['api_key'][:key]
102
- value = 'foo'
103
- cookie = "#{key}=#{value};Path=/rest;Secure;HttpOnly"
104
- set_cookie_header = { 'set-cookie' => cookie }
105
- stub_request(:get, url + '1').to_return(headers: set_cookie_header)
106
- stub_request(:get, url + '2')
107
-
108
- subject.call_api(:GET, '/test1')
109
- subject.call_api(:GET, '/test2', auth_names: ['api_key'])
110
-
111
- expect(a_request(:get, url + '1')).to have_been_made
112
- expect(a_request(:get, url + '2')).to have_been_made
113
- expect(subject.config.api_key[key]).to eq(value)
114
- end
115
-
116
- it 'updates api_key from responses with api_key header' do
117
- key = config.auth_settings['api_key'][:key]
118
- value = 'foo'
119
- auth_header = { key => value }
120
-
121
- stub_request(:get, url + '1').to_return(headers: auth_header)
122
- stub_request(:get, url + '2').with(headers: auth_header)
123
-
124
- subject.call_api(:GET, '/test1')
125
- subject.call_api(:GET, '/test2', auth_names: ['api_key'])
126
-
127
- expect(a_request(:get, url + '1')).to have_been_made
128
- expect(a_request(:get, url + '2')
129
- .with(headers: auth_header)).to have_been_made
130
- end
131
-
132
- it 'adds the body to requests when available' do
133
- body = { foo: 'bar' }.to_json
134
- stub_request(:post, url).with(body: body)
135
-
136
- subject.call_api(:POST, '/test', body: body)
137
-
138
- expect(a_request(:post, url).with(body: body)).to have_been_made
139
- end
140
-
141
- it 'sets the Content-Type on requests when available' do
142
- content_type = { 'Content-Type' => 'application/json' }
143
- body = { foo: 'bar' }.to_json
144
-
145
- stub_request(:post, url).with(body: body, headers: content_type)
146
-
147
- subject.call_api(:POST, '/test', body: body, header_params: content_type)
148
-
149
- expect(a_request(:post, url)
150
- .with(body: body, headers: content_type)).to have_been_made
151
- end
152
- end
153
-
154
- describe '#object_to_http_body' do
155
- context 'when given nil' do
156
- it 'returns the object as is' do
157
- expect(subject.object_to_http_body(nil)).to be_nil
158
- end
159
- end
160
-
161
- context 'when given a string' do
162
- it 'returns the object as is' do
163
- expect(subject.object_to_http_body('asdf')).to eq('asdf')
164
- end
165
- end
166
-
167
- context 'when given an object that responds to `to_hash`' do
168
- it 'returns that object as JSON' do
169
- obj = OpenStruct.new(foo: 'bar', baz: 'quux')
170
- obj.to_hash = obj.to_h
171
- json = obj.to_hash.to_json
172
-
173
- expect(subject.object_to_http_body(obj)).to eq(json)
174
- end
175
- end
176
-
177
- context 'when given an array' do
178
- it 'returns a JSON array of objects' do
179
- obj = OpenStruct.new(foo: 'bar', baz: 'quux')
180
- obj.to_hash = obj.to_h
181
- json = obj.to_hash.to_json
182
-
183
- expect(subject.object_to_http_body([obj])).to eq([json])
184
- end
185
- end
186
- end
187
-
188
- describe '#select_header_accept' do
189
- context 'when given anything other than an array' do
190
- it 'returns application/json as a default' do
191
- expect(subject.select_header_accept(nil)).to eq('application/json')
192
- expect(subject.select_header_accept('')).to eq('application/json')
193
- expect(subject.select_header_accept(1)).to eq('application/json')
194
- end
195
- end
196
-
197
- context 'when given a list of types' do
198
- context 'that includes a JSON type' do
199
- it 'returns the first type containing JSON' do
200
- xml = 'application/xml'
201
- json = 'application/json'
202
-
203
- expect(subject.select_header_accept([xml, json])).to eq(json)
204
- end
205
- end
206
-
207
- context 'that does not include a JSON type' do
208
- it 'returns the all of the types' do
209
- xml = 'application/xml'
210
- html = 'text/html'
211
- result = [xml, html].join(', ')
212
-
213
- expect(subject.select_header_accept([xml, html])).to eq(result)
214
- end
215
- end
216
- end
217
- end
218
-
219
- describe '#select_header_content_type' do
220
- context 'when given anything other than an array' do
221
- it 'returns application/json as a default' do
222
- expect(subject.select_header_content_type(nil)).to eq('application/json')
223
- expect(subject.select_header_content_type('')).to eq('application/json')
224
- expect(subject.select_header_content_type(1)).to eq('application/json')
225
- end
226
- end
227
-
228
- context 'when given a list of types' do
229
- context 'that includes a JSON type' do
230
- it 'returns the first type containing JSON' do
231
- xml = 'application/xml'
232
- json = 'application/json'
233
-
234
- expect(subject.select_header_content_type([xml, json])).to eq(json)
235
- end
236
- end
237
-
238
- context 'that does not include a JSON type' do
239
- it 'returns the first type' do
240
- xml = 'application/xml'
241
- html = 'text/html'
242
-
243
- expect(subject.select_header_content_type([xml, html])).to eq(xml)
244
- end
245
- end
246
- end
247
- end
248
- end
@@ -1,38 +0,0 @@
1
- # Copyright (c) 2018-2019 VMware, Inc. All Rights Reserved.
2
- # SPDX-License-Identifier: MIT
3
-
4
- # DO NOT MODIFY. THIS CODE IS GENERATED. CHANGES WILL BE OVERWRITTEN.
5
-
6
- # runtime - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
-
8
-
9
- require 'spec_helper'
10
-
11
- describe VSphereAutomation::Configuration do
12
- let(:config) { VSphereAutomation::Configuration.default }
13
-
14
- before(:each) do
15
- # uncomment below to setup host and base_path
16
- # require 'URI'
17
- # uri = URI.parse("https://<vcenter>/rest")
18
- # VSphereAutomation.configure do |c|
19
- # c.host = uri.host
20
- # c.base_path = uri.path
21
- # end
22
- end
23
-
24
- describe '#base_url' do
25
- it 'should have the default value' do
26
- # uncomment below to test default value of the base path
27
- # expect(config.base_url).to eq("https://<vcenter>/rest")
28
- end
29
-
30
- it 'should remove trailing slashes' do
31
- [nil, '', '/', '//'].each do |base_path|
32
- config.base_path = base_path
33
- # uncomment below to test trailing slashes
34
- # expect(config.base_url).to eq("https://<vcenter>/rest")
35
- end
36
- end
37
- end
38
- end
@@ -1,110 +0,0 @@
1
- # Copyright (c) 2018-2019 VMware, Inc. All Rights Reserved.
2
- # SPDX-License-Identifier: MIT
3
-
4
- # DO NOT MODIFY. THIS CODE IS GENERATED. CHANGES WILL BE OVERWRITTEN.
5
-
6
- # runtime - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
-
8
-
9
- # load the gem
10
- require 'vsphere-automation-runtime'
11
- require 'webmock/rspec'
12
-
13
- WebMock.disable_net_connect!(allow_localhost: true)
14
-
15
- # The following was generated by the `rspec --init` command. Conventionally, all
16
- # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
17
- # The generated `.rspec` file contains `--require spec_helper` which will cause
18
- # this file to always be loaded, without a need to explicitly require it in any
19
- # files.
20
- #
21
- # Given that it is always loaded, you are encouraged to keep this file as
22
- # light-weight as possible. Requiring heavyweight dependencies from this file
23
- # will add to the boot time of your test suite on EVERY test run, even for an
24
- # individual file that may not need all of that loaded. Instead, consider making
25
- # a separate helper file that requires the additional dependencies and performs
26
- # the additional setup, and require it from the spec files that actually need
27
- # it.
28
- #
29
- # The `.rspec` file also contains a few flags that are not defaults but that
30
- # users commonly want.
31
- #
32
- # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
33
- RSpec.configure do |config|
34
- # rspec-expectations config goes here. You can use an alternate
35
- # assertion/expectation library such as wrong or the stdlib/minitest
36
- # assertions if you prefer.
37
- config.expect_with :rspec do |expectations|
38
- # This option will default to `true` in RSpec 4. It makes the `description`
39
- # and `failure_message` of custom matchers include text for helper methods
40
- # defined using `chain`, e.g.:
41
- # be_bigger_than(2).and_smaller_than(4).description
42
- # # => "be bigger than 2 and smaller than 4"
43
- # ...rather than:
44
- # # => "be bigger than 2"
45
- expectations.include_chain_clauses_in_custom_matcher_descriptions = true
46
- end
47
-
48
- # rspec-mocks config goes here. You can use an alternate test double
49
- # library (such as bogus or mocha) by changing the `mock_with` option here.
50
- config.mock_with :rspec do |mocks|
51
- # Prevents you from mocking or stubbing a method that does not exist on
52
- # a real object. This is generally recommended, and will default to
53
- # `true` in RSpec 4.
54
- mocks.verify_partial_doubles = true
55
- end
56
-
57
- # The settings below are suggested to provide a good initial experience
58
- # with RSpec, but feel free to customize to your heart's content.
59
- =begin
60
- # These two settings work together to allow you to limit a spec run
61
- # to individual examples or groups you care about by tagging them with
62
- # `:focus` metadata. When nothing is tagged with `:focus`, all examples
63
- # get run.
64
- config.filter_run :focus
65
- config.run_all_when_everything_filtered = true
66
-
67
- # Allows RSpec to persist some state between runs in order to support
68
- # the `--only-failures` and `--next-failure` CLI options. We recommend
69
- # you configure your source control system to ignore this file.
70
- config.example_status_persistence_file_path = "spec/examples.txt"
71
-
72
- # Limits the available syntax to the non-monkey patched syntax that is
73
- # recommended. For more details, see:
74
- # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
75
- # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
76
- # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
77
- config.disable_monkey_patching!
78
-
79
- # This setting enables warnings. It's recommended, but in some cases may
80
- # be too noisy due to issues in dependencies.
81
- config.warnings = true
82
-
83
- # Many RSpec users commonly either run the entire suite or an individual
84
- # file, and it's useful to allow more verbose output when running an
85
- # individual spec file.
86
- if config.files_to_run.one?
87
- # Use the documentation formatter for detailed output,
88
- # unless a formatter has already been configured
89
- # (e.g. via a command-line flag).
90
- config.default_formatter = 'doc'
91
- end
92
-
93
- # Print the 10 slowest examples and example groups at the
94
- # end of the spec run, to help surface which specs are running
95
- # particularly slow.
96
- config.profile_examples = 10
97
-
98
- # Run specs in random order to surface order dependencies. If you find an
99
- # order dependency and want to debug it, you can fix the order by providing
100
- # the seed, which is printed after each run.
101
- # --seed 1234
102
- config.order = :random
103
-
104
- # Seed global randomization in this process using the `--seed` CLI option.
105
- # Setting this allows you to use `--seed` to deterministically reproduce
106
- # test failures related to randomization by passing the same `--seed` value
107
- # as the one that triggered the failure.
108
- Kernel.srand config.seed
109
- =end
110
- end