vmware-vra 2.7.2 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -1
- data/CHANGELOG.md +5 -0
- data/README.md +79 -144
- data/Rakefile +0 -11
- data/lib/vra/catalog.rb +39 -8
- data/lib/vra/catalog_base.rb +62 -0
- data/lib/vra/catalog_item.rb +28 -74
- data/lib/vra/catalog_source.rb +116 -0
- data/lib/vra/catalog_type.rb +56 -0
- data/lib/vra/client.rb +62 -54
- data/lib/vra/deployment.rb +155 -0
- data/lib/vra/deployment_request.rb +117 -0
- data/lib/vra/{resources.rb → deployments.rb} +26 -17
- data/lib/vra/exceptions.rb +1 -1
- data/lib/vra/http.rb +11 -6
- data/lib/vra/request.rb +28 -36
- data/lib/vra/request_parameters.rb +12 -12
- data/lib/vra/resource.rb +32 -203
- data/lib/vra/version.rb +2 -2
- data/lib/vra.rb +15 -12
- data/spec/catalog_item_spec.rb +64 -222
- data/spec/catalog_source_spec.rb +178 -0
- data/spec/catalog_spec.rb +112 -72
- data/spec/catalog_type_spec.rb +114 -0
- data/spec/client_spec.rb +271 -226
- data/spec/deployment_request_spec.rb +192 -0
- data/spec/deployment_spec.rb +227 -0
- data/spec/deployments_spec.rb +80 -0
- data/spec/fixtures/resource/sample_catalog_item.json +18 -0
- data/spec/fixtures/resource/sample_catalog_item_2.json +18 -0
- data/spec/fixtures/resource/sample_catalog_source.json +20 -0
- data/spec/fixtures/resource/sample_catalog_type.json +49 -0
- data/spec/fixtures/resource/sample_dep_actions.json +58 -0
- data/spec/fixtures/resource/sample_dep_request.json +19 -0
- data/spec/fixtures/resource/sample_dep_resource.json +112 -0
- data/spec/fixtures/resource/sample_deployment.json +26 -0
- data/spec/fixtures/resource/sample_entitlements.json +25 -0
- data/spec/http_spec.rb +63 -61
- data/spec/request_spec.rb +62 -68
- data/spec/resource_spec.rb +71 -390
- data/spec/spec_helper.rb +10 -4
- data/vmware-vra.gemspec +0 -1
- metadata +40 -30
- data/.travis.yml +0 -14
- data/lib/vra/catalog_request.rb +0 -137
- data/lib/vra/requests.rb +0 -41
- data/spec/catalog_request_spec.rb +0 -268
- data/spec/requests_spec.rb +0 -60
- data/spec/resources_spec.rb +0 -71
data/spec/resources_spec.rb
DELETED
@@ -1,71 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
#
|
3
|
-
# Author:: Chef Partner Engineering (<partnereng@chef.io>)
|
4
|
-
# Copyright:: Copyright (c) 2015 Chef Software, Inc.
|
5
|
-
# License:: Apache License, Version 2.0
|
6
|
-
#
|
7
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
-
# you may not use this file except in compliance with the License.
|
9
|
-
# You may obtain a copy of the License at
|
10
|
-
#
|
11
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
-
#
|
13
|
-
# Unless required by applicable law or agreed to in writing, software
|
14
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
-
# See the License for the specific language governing permissions and
|
17
|
-
# limitations under the License.
|
18
|
-
#
|
19
|
-
|
20
|
-
require "spec_helper"
|
21
|
-
|
22
|
-
describe Vra::Resources do
|
23
|
-
let(:client) do
|
24
|
-
Vra::Client.new(username: "user@corp.local",
|
25
|
-
password: "password",
|
26
|
-
tenant: "tenant",
|
27
|
-
base_url: "https://vra.corp.local")
|
28
|
-
end
|
29
|
-
|
30
|
-
let(:resources) { Vra::Resources.new(client) }
|
31
|
-
|
32
|
-
it "#all" do
|
33
|
-
allow(client).to receive(:http_get_paginated_array!)
|
34
|
-
.with("/catalog-service/api/consumer/resources")
|
35
|
-
.and_return([ { "id" => "1" }, { "id" => "2" } ])
|
36
|
-
|
37
|
-
items = resources.all_resources
|
38
|
-
|
39
|
-
expect(items[0]).to be_an_instance_of(Vra::Resource)
|
40
|
-
expect(items[1]).to be_an_instance_of(Vra::Resource)
|
41
|
-
end
|
42
|
-
|
43
|
-
describe "#all_resources" do
|
44
|
-
it "calls the resources API endpoint" do
|
45
|
-
expect(client).to receive(:http_get_paginated_array!)
|
46
|
-
.with("/catalog-service/api/consumer/resources")
|
47
|
-
.and_return([])
|
48
|
-
|
49
|
-
resources.all_resources
|
50
|
-
end
|
51
|
-
|
52
|
-
it "returns an array of resource objects" do
|
53
|
-
allow(client).to receive(:http_get_paginated_array!)
|
54
|
-
.with("/catalog-service/api/consumer/resources")
|
55
|
-
.and_return([ { "id" => "1" }, { "id" => "2" } ])
|
56
|
-
|
57
|
-
items = resources.all_resources
|
58
|
-
|
59
|
-
expect(items[0]).to be_an_instance_of(Vra::Resource)
|
60
|
-
expect(items[1]).to be_an_instance_of(Vra::Resource)
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
describe "#by_id" do
|
65
|
-
it "returns a resource object" do
|
66
|
-
expect(Vra::Resource).to receive(:new).with(client, id: "12345")
|
67
|
-
|
68
|
-
resources.by_id("12345")
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|