fog 0.0.93 → 0.0.94
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.
- data/Gemfile +2 -1
- data/Gemfile.lock +13 -7
- data/bin/fog +6 -0
- data/fog.gemspec +40 -3
- data/lib/fog.rb +2 -1
- data/lib/fog/aws.rb +12 -8
- data/lib/fog/aws/parsers/s3/get_bucket_logging.rb +40 -0
- data/lib/fog/aws/parsers/s3/get_bucket_object_versions.rb +88 -0
- data/lib/fog/aws/parsers/s3/get_bucket_versioning.rb +24 -0
- data/lib/fog/aws/requests/ec2/associate_address.rb +3 -0
- data/lib/fog/aws/requests/ec2/describe_instances.rb +4 -3
- data/lib/fog/aws/requests/ec2/disassociate_address.rb +4 -0
- data/lib/fog/aws/requests/s3/get_bucket.rb +6 -5
- data/lib/fog/aws/requests/s3/get_bucket_logging.rb +53 -0
- data/lib/fog/aws/requests/s3/get_bucket_object_versions.rb +83 -0
- data/lib/fog/aws/requests/s3/get_bucket_versioning.rb +43 -0
- data/lib/fog/aws/requests/s3/get_object.rb +6 -1
- data/lib/fog/aws/requests/s3/get_object_acl.rb +8 -2
- data/lib/fog/aws/requests/s3/head_object.rb +4 -1
- data/lib/fog/aws/requests/s3/put_bucket_acl.rb +1 -1
- data/lib/fog/aws/requests/s3/put_bucket_logging.rb +87 -0
- data/lib/fog/aws/requests/s3/put_bucket_versioning.rb +40 -0
- data/lib/fog/aws/s3.rb +9 -1
- data/lib/fog/bin.rb +1 -1
- data/lib/fog/credentials.rb +6 -2
- data/lib/fog/vcloud.rb +288 -0
- data/lib/fog/vcloud/bin.rb +57 -0
- data/lib/fog/vcloud/parser.rb +34 -0
- data/lib/fog/vcloud/parsers/get_organization.rb +37 -0
- data/lib/fog/vcloud/parsers/get_vdc.rb +37 -0
- data/lib/fog/vcloud/parsers/get_versions.rb +46 -0
- data/lib/fog/vcloud/parsers/login.rb +40 -0
- data/lib/fog/vcloud/requests/get_organization.rb +55 -0
- data/lib/fog/vcloud/requests/get_vdc.rb +59 -0
- data/lib/fog/vcloud/requests/get_versions.rb +43 -0
- data/lib/fog/vcloud/requests/login.rb +46 -0
- data/lib/fog/vcloud/terremark/all.rb +9 -0
- data/lib/fog/vcloud/terremark/ecloud.rb +47 -0
- data/lib/fog/vcloud/terremark/ecloud/parsers/get_vdc.rb +59 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/get_vdc.rb +94 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/login.rb +27 -0
- data/lib/fog/vcloud/terremark/vcloud.rb +43 -0
- data/lib/fog/vcloud/terremark/vcloud/parsers/get_vdc.rb +34 -0
- data/lib/fog/vcloud/terremark/vcloud/requests/get_vdc.rb +65 -0
- data/spec/aws/requests/ec2/describe_instances_spec.rb +4 -4
- data/spec/spec_helper.rb +3 -1
- data/spec/vcloud/bin_spec.rb +31 -0
- data/spec/vcloud/requests/get_organization_spec.rb +46 -0
- data/spec/vcloud/requests/get_vdc_spec.rb +50 -0
- data/spec/vcloud/requests/get_versions_spec.rb +28 -0
- data/spec/vcloud/requests/login_spec.rb +8 -0
- data/spec/vcloud/spec_helper.rb +184 -0
- data/spec/vcloud/terremark/ecloud/requests/get_vdc_spec.rb +135 -0
- data/spec/vcloud/terremark/ecloud/requests/login_spec.rb +7 -0
- data/spec/vcloud/terremark/vcloud/requests/get_vdc_spec.rb +74 -0
- data/spec/vcloud/vcloud_spec.rb +17 -0
- data/tests/aws/requests/ec2/address_tests.rb +3 -0
- metadata +42 -5
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Fog::Vcloud, :type => :vcloud_request do
|
|
4
|
+
subject { @vcloud }
|
|
5
|
+
|
|
6
|
+
it { should respond_to :get_versions }
|
|
7
|
+
|
|
8
|
+
describe "#get_versions" do
|
|
9
|
+
before { @versions = @vcloud.get_versions }
|
|
10
|
+
subject { @versions }
|
|
11
|
+
|
|
12
|
+
it_should_behave_like "all requests"
|
|
13
|
+
|
|
14
|
+
its(:body) { should have(1).version }
|
|
15
|
+
|
|
16
|
+
describe "body.first" do
|
|
17
|
+
let(:version) { @versions.body.first }
|
|
18
|
+
subject { version }
|
|
19
|
+
|
|
20
|
+
its(:login_url) { should == @mock_version[:login_url] }
|
|
21
|
+
|
|
22
|
+
its(:version) { should == @mock_version[:version] }
|
|
23
|
+
|
|
24
|
+
its(:supported) { should == @mock_version[:supported] }
|
|
25
|
+
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
require 'spec'
|
|
2
|
+
require 'pp'
|
|
3
|
+
|
|
4
|
+
current_directory = File.dirname(__FILE__)
|
|
5
|
+
require "#{current_directory}/../../lib/fog"
|
|
6
|
+
require "#{current_directory}/../../lib/fog/bin"
|
|
7
|
+
|
|
8
|
+
Fog.mock!
|
|
9
|
+
|
|
10
|
+
require "#{current_directory}/../../lib/fog/vcloud/bin"
|
|
11
|
+
|
|
12
|
+
shared_examples_for "all requests" do
|
|
13
|
+
it { should respond_to :body }
|
|
14
|
+
it { should respond_to :headers }
|
|
15
|
+
it { should have_at_least(1).body }
|
|
16
|
+
it { should have_at_least(0).headers }
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
shared_examples_for "all rel=down vcloud links" do
|
|
20
|
+
it { should be_an_instance_of Struct::VcloudLink }
|
|
21
|
+
specify { subject.rel.should == "down" }
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
shared_examples_for "all vcloud links w/o a rel" do
|
|
25
|
+
it { should be_an_instance_of Struct::VcloudLink }
|
|
26
|
+
specify { subject.rel.should == nil }
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
shared_examples_for "all vcloud catalog links" do
|
|
30
|
+
specify { subject.type.should == "application/vnd.vmware.vcloud.catalog+xml" }
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
shared_examples_for "all tmrk ecloud publicIpList links" do
|
|
34
|
+
specify { subject.type.should == "application/vnd.tmrk.ecloud.publicIpsList+xml" }
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
shared_examples_for "all tmrk ecloud firewallAclList links" do
|
|
38
|
+
specify { subject.type.should == "application/vnd.tmrk.ecloud.firewallAclsList+xml" }
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
shared_examples_for "all tmrk ecloud internetServicesList links" do
|
|
42
|
+
specify { subject.type.should == "application/vnd.tmrk.ecloud.internetServicesList+xml" }
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
shared_examples_for "all vcloud application/xml types" do
|
|
46
|
+
specify { subject.type.should == "application/xml" }
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
shared_examples_for "a vapp type" do
|
|
50
|
+
specify { subject.type.should == "application/vnd.vmware.vcloud.vApp+xml" }
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
shared_examples_for "all vcloud network types" do
|
|
54
|
+
specify { subject.type.should == "application/vnd.vmware.vcloud.network+xml" }
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
shared_examples_for "all login requests" do
|
|
58
|
+
|
|
59
|
+
it { should respond_to :login }
|
|
60
|
+
|
|
61
|
+
describe "#login" do
|
|
62
|
+
before { @login = @vcloud.login }
|
|
63
|
+
subject { @login }
|
|
64
|
+
|
|
65
|
+
it_should_behave_like "all requests"
|
|
66
|
+
|
|
67
|
+
its(:headers) { should include "Set-Cookie" }
|
|
68
|
+
its(:headers) { should include "Content-Type" }
|
|
69
|
+
its(:body) { should be_an_instance_of Struct::VcloudOrgList }
|
|
70
|
+
|
|
71
|
+
describe "#body" do
|
|
72
|
+
before { @orglist = @login.body }
|
|
73
|
+
subject { @orglist }
|
|
74
|
+
|
|
75
|
+
its(:xmlns) { should == "http://www.vmware.com/vcloud/v0.8" }
|
|
76
|
+
|
|
77
|
+
it { should have(1).organizations }
|
|
78
|
+
|
|
79
|
+
describe "#first" do
|
|
80
|
+
before { @org = @orglist.organizations.first }
|
|
81
|
+
subject { @org }
|
|
82
|
+
|
|
83
|
+
it { should be_an_instance_of Struct::VcloudOrgLink }
|
|
84
|
+
|
|
85
|
+
its(:href) { should == @mock_organization[:info][:href] }
|
|
86
|
+
its(:name) { should == @mock_organization[:info][:name] }
|
|
87
|
+
its(:type) { should == "application/vnd.vmware.vcloud.org+xml" }
|
|
88
|
+
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
shared_examples_for "it has a vcloud v0.8 xmlns" do
|
|
95
|
+
its(:xmlns) { should == 'http://www.vmware.com/vcloud/v0.8' }
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
shared_examples_for "a request for a resource that doesn't exist" do
|
|
99
|
+
it { should raise_error Excon::Errors::Unauthorized }
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
shared_examples_for "a vdc catalog link" do
|
|
103
|
+
it_should_behave_like "all rel=down vcloud links"
|
|
104
|
+
it_should_behave_like "all vcloud catalog links"
|
|
105
|
+
its(:href) { should == @mock_vdc[:href] + "/catalog" }
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
shared_examples_for "a tmrk vdc" do
|
|
109
|
+
it { should respond_to :links }
|
|
110
|
+
it { should respond_to :networks }
|
|
111
|
+
it { should respond_to :resource_entities }
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
shared_examples_for "a tmrk network link" do
|
|
115
|
+
it_should_behave_like "all vcloud links w/o a rel"
|
|
116
|
+
it_should_behave_like "all vcloud network types"
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
shared_examples_for "the mocked tmrk network links" do
|
|
120
|
+
it { should have(2).networks }
|
|
121
|
+
|
|
122
|
+
describe "[0]" do
|
|
123
|
+
subject { @vdc.body.networks[0] }
|
|
124
|
+
it_should_behave_like "a tmrk network link"
|
|
125
|
+
its(:href) { should == @mock_vdc[:networks][0][:href] }
|
|
126
|
+
its(:name) { should == @mock_vdc[:networks][0][:name] }
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
describe "[1]" do
|
|
130
|
+
subject { @vdc.body.networks[1] }
|
|
131
|
+
it_should_behave_like "a tmrk network link"
|
|
132
|
+
its(:href) { should == @mock_vdc[:networks][1][:href] }
|
|
133
|
+
its(:name) { should == @mock_vdc[:networks][1][:name] }
|
|
134
|
+
end
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
shared_examples_for "the mocked tmrk resource entity links" do
|
|
138
|
+
it { should have(3).resource_entities }
|
|
139
|
+
|
|
140
|
+
describe "[0]" do
|
|
141
|
+
subject { @vdc.body.resource_entities[0] }
|
|
142
|
+
it_should_behave_like "a vapp type"
|
|
143
|
+
it_should_behave_like "all vcloud links w/o a rel"
|
|
144
|
+
its(:href) { should == @mock_vdc[:vms][0][:href] }
|
|
145
|
+
its(:name) { should == @mock_vdc[:vms][0][:name] }
|
|
146
|
+
end
|
|
147
|
+
describe "[1]" do
|
|
148
|
+
subject { @vdc.body.resource_entities[1] }
|
|
149
|
+
it_should_behave_like "a vapp type"
|
|
150
|
+
it_should_behave_like "all vcloud links w/o a rel"
|
|
151
|
+
its(:href) { should == @mock_vdc[:vms][1][:href] }
|
|
152
|
+
its(:name) { should == @mock_vdc[:vms][1][:name] }
|
|
153
|
+
end
|
|
154
|
+
describe "[2]" do
|
|
155
|
+
subject { @vdc.body.resource_entities[2] }
|
|
156
|
+
it_should_behave_like "a vapp type"
|
|
157
|
+
it_should_behave_like "all vcloud links w/o a rel"
|
|
158
|
+
its(:href) { should == @mock_vdc[:vms][2][:href] }
|
|
159
|
+
its(:name) { should == @mock_vdc[:vms][2][:name] }
|
|
160
|
+
end
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
Spec::Example::ExampleGroupFactory.register(:vcloud_request, Class.new(Spec::Example::ExampleGroup))
|
|
164
|
+
Spec::Example::ExampleGroupFactory.register(:tmrk_ecloud_request, Class.new(Spec::Example::ExampleGroup))
|
|
165
|
+
Spec::Example::ExampleGroupFactory.register(:tmrk_vcloud_request, Class.new(Spec::Example::ExampleGroup))
|
|
166
|
+
|
|
167
|
+
Spec::Runner.configure do |config|
|
|
168
|
+
config.before(:all) do
|
|
169
|
+
@mock_data = Fog::Vcloud::Mock::DATA
|
|
170
|
+
@mock_version = @mock_data[:versions][0]
|
|
171
|
+
@mock_organization = @mock_data[:organizations][0]
|
|
172
|
+
@mock_vdc = @mock_organization[:vdcs][0]
|
|
173
|
+
end
|
|
174
|
+
config.before(:each, :type => :vcloud_request) do
|
|
175
|
+
@vcloud = Fog::Vcloud.new
|
|
176
|
+
end
|
|
177
|
+
config.before(:each, :type => :tmrk_ecloud_request) do
|
|
178
|
+
@vcloud = Fog::Vcloud.new(:module => "Fog::Vcloud::Terremark::Ecloud")
|
|
179
|
+
end
|
|
180
|
+
config.before(:each, :type => :tmrk_vcloud_request) do
|
|
181
|
+
@vcloud = Fog::Vcloud.new(:module => "Fog::Vcloud::Terremark::Vcloud")
|
|
182
|
+
end
|
|
183
|
+
end
|
|
184
|
+
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
|
|
3
|
+
describe "Fog::Vcloud, initialized w/ the TMRK Ecloud module", :type => :tmrk_ecloud_request do
|
|
4
|
+
subject { @vcloud }
|
|
5
|
+
|
|
6
|
+
it { should respond_to :get_vdc }
|
|
7
|
+
|
|
8
|
+
describe "#get_vdc" do
|
|
9
|
+
context "with a valid vdc uri" do
|
|
10
|
+
before { @vdc = @vcloud.get_vdc(@mock_vdc[:href]) }
|
|
11
|
+
subject { @vdc }
|
|
12
|
+
|
|
13
|
+
it_should_behave_like "all requests"
|
|
14
|
+
|
|
15
|
+
its(:headers) { should include "Content-Type" }
|
|
16
|
+
its(:body) { should be_an_instance_of Struct::TmrkEcloudVdc }
|
|
17
|
+
|
|
18
|
+
describe "#headers" do
|
|
19
|
+
let(:header) { @vdc.headers["Content-Type"] }
|
|
20
|
+
specify { header.should == "application/vnd.vmware.vcloud.vdc+xml" }
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
describe "#body" do
|
|
24
|
+
subject { @vdc.body }
|
|
25
|
+
|
|
26
|
+
it_should_behave_like "it has a vcloud v0.8 xmlns"
|
|
27
|
+
it_should_behave_like "a tmrk vdc"
|
|
28
|
+
|
|
29
|
+
it { should respond_to :storage_capacity }
|
|
30
|
+
it { should respond_to :cpu_capacity }
|
|
31
|
+
it { should respond_to :memory_capacity }
|
|
32
|
+
it { should respond_to :deployed_vm_quota }
|
|
33
|
+
it { should respond_to :instantiated_vm_quota }
|
|
34
|
+
|
|
35
|
+
its(:name) { should == @mock_vdc[:name] }
|
|
36
|
+
its(:href) { should == @mock_vdc[:href] }
|
|
37
|
+
its(:description) { should == '' }
|
|
38
|
+
|
|
39
|
+
describe "#links" do
|
|
40
|
+
subject { @vdc.body.links }
|
|
41
|
+
it { should have(4).links }
|
|
42
|
+
|
|
43
|
+
describe "[0]" do
|
|
44
|
+
subject { @vdc.body.links[0] }
|
|
45
|
+
it_should_behave_like "a vdc catalog link"
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
describe "[1]" do
|
|
49
|
+
subject { @vdc.body.links[1] }
|
|
50
|
+
|
|
51
|
+
it_should_behave_like "all rel=down vcloud links"
|
|
52
|
+
it_should_behave_like "all tmrk ecloud publicIpList links"
|
|
53
|
+
|
|
54
|
+
specify { subject.href.should == @mock_vdc[:href].sub('/vdc','/extensions/vdc') + "/publicIps" }
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
describe "[2]" do
|
|
58
|
+
subject { @vdc.body.links[2] }
|
|
59
|
+
|
|
60
|
+
it_should_behave_like "all rel=down vcloud links"
|
|
61
|
+
it_should_behave_like "all tmrk ecloud internetServicesList links"
|
|
62
|
+
|
|
63
|
+
specify { subject.href.should == @mock_vdc[:href] + "/internetServices" }
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
describe "[3]" do
|
|
67
|
+
subject { @vdc.body.links[3] }
|
|
68
|
+
|
|
69
|
+
it_should_behave_like "all rel=down vcloud links"
|
|
70
|
+
it_should_behave_like "all tmrk ecloud firewallAclList links"
|
|
71
|
+
|
|
72
|
+
specify { subject.href.should == @mock_vdc[:href].sub('/vdc','/extensions/vdc') + "/firewallAcls" }
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
describe "#networks" do
|
|
77
|
+
subject { @vdc.body.networks }
|
|
78
|
+
it_should_behave_like "the mocked tmrk network links"
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
describe "#storage_capacity" do
|
|
82
|
+
subject { @vdc.body.storage_capacity }
|
|
83
|
+
|
|
84
|
+
its(:units) { should == "bytes * 10^9" }
|
|
85
|
+
its(:allocated) { should == @mock_vdc[:storage][:allocated] }
|
|
86
|
+
its(:used) { should == @mock_vdc[:storage][:used] }
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
describe "#cpu_capacity" do
|
|
90
|
+
subject { @vdc.body.cpu_capacity }
|
|
91
|
+
its(:units) { should == "hz * 10^6" }
|
|
92
|
+
its(:allocated) { should == @mock_vdc[:cpu][:allocated] }
|
|
93
|
+
its(:used) { should == nil }
|
|
94
|
+
its(:limit) { should == nil }
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
describe "#memory_capacity" do
|
|
98
|
+
subject { @vdc.body.memory_capacity }
|
|
99
|
+
it { should be_an_instance_of Struct::TmrkEcloudXCapacity }
|
|
100
|
+
its(:units) { should == "bytes * 2^20" }
|
|
101
|
+
its(:allocated) { should == @mock_vdc[:memory][:allocated] }
|
|
102
|
+
its(:used) { should == nil }
|
|
103
|
+
its(:limit) { should == nil }
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
describe "#deployed_vm_quota" do
|
|
107
|
+
subject { @vdc.body.deployed_vm_quota }
|
|
108
|
+
it { should be_an_instance_of Struct::TmrkEcloudXCapacity }
|
|
109
|
+
its(:limit) { should == -1 }
|
|
110
|
+
its(:used) { should == -1 }
|
|
111
|
+
its(:units) { should == nil }
|
|
112
|
+
its(:allocated) { should == nil }
|
|
113
|
+
end
|
|
114
|
+
describe "#instantiated_vm_quota" do
|
|
115
|
+
subject { @vdc.body.instantiated_vm_quota }
|
|
116
|
+
it { should be_an_instance_of Struct::TmrkEcloudXCapacity }
|
|
117
|
+
its(:limit) { should == -1 }
|
|
118
|
+
its(:used) { should == -1 }
|
|
119
|
+
its(:units) { should == nil }
|
|
120
|
+
its(:allocated) { should == nil }
|
|
121
|
+
end
|
|
122
|
+
describe "#resource_entities" do
|
|
123
|
+
subject { @vdc.body.resource_entities }
|
|
124
|
+
it_should_behave_like "the mocked tmrk resource entity links"
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
context "with a vdc uri that doesn't exist" do
|
|
130
|
+
subject { lambda { @vcloud.get_vdc(URI.parse('https://www.fakey.com/api/v0.8/vdc/999')) } }
|
|
131
|
+
|
|
132
|
+
it_should_behave_like "a request for a resource that doesn't exist"
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
end
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
|
|
3
|
+
describe "Fog::Vcloud, initialized w/ the TMRK Vcloud module", :type => :tmrk_vcloud_request do
|
|
4
|
+
subject { @vcloud }
|
|
5
|
+
|
|
6
|
+
it { should respond_to :get_vdc }
|
|
7
|
+
|
|
8
|
+
describe :get_vdc do
|
|
9
|
+
context "with a valid vdc uri" do
|
|
10
|
+
before { @vdc = @vcloud.get_vdc(@mock_vdc[:href]) }
|
|
11
|
+
subject { @vdc }
|
|
12
|
+
|
|
13
|
+
it_should_behave_like "all requests"
|
|
14
|
+
|
|
15
|
+
its(:headers) { should include "Content-Type" }
|
|
16
|
+
its(:body) { should be_an_instance_of Struct::TmrkVcloudVdc }
|
|
17
|
+
|
|
18
|
+
describe :headers do
|
|
19
|
+
let(:header) { @vdc.headers["Content-Type"] }
|
|
20
|
+
specify { header.should == "application/vnd.vmware.vcloud.vdc+xml" }
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
describe :body do
|
|
24
|
+
subject { @vdc.body }
|
|
25
|
+
|
|
26
|
+
it_should_behave_like "it has a vcloud v0.8 xmlns"
|
|
27
|
+
it_should_behave_like "a tmrk vdc"
|
|
28
|
+
|
|
29
|
+
its(:name) { should == @mock_vdc[:name] }
|
|
30
|
+
its(:href) { should == @mock_vdc[:href] }
|
|
31
|
+
|
|
32
|
+
describe "#links" do
|
|
33
|
+
subject { @vdc.body.links }
|
|
34
|
+
it { should have(3).links }
|
|
35
|
+
|
|
36
|
+
describe "#link[0]" do
|
|
37
|
+
subject { @vdc.body.links[0] }
|
|
38
|
+
it_should_behave_like "a vdc catalog link"
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
describe "#link[1]" do
|
|
42
|
+
subject { @vdc.body.links[1] }
|
|
43
|
+
|
|
44
|
+
it_should_behave_like "all rel=down vcloud links"
|
|
45
|
+
it_should_behave_like "all vcloud application/xml types"
|
|
46
|
+
specify { subject.href.should == @mock_vdc[:href] + "/publicIps" }
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
describe "#link[2]" do
|
|
50
|
+
subject { @vdc.body.links[2] }
|
|
51
|
+
|
|
52
|
+
it_should_behave_like "all rel=down vcloud links"
|
|
53
|
+
it_should_behave_like "all vcloud application/xml types"
|
|
54
|
+
specify { subject.href.should == @mock_vdc[:href] + "/internetServices" }
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
describe :networks do
|
|
58
|
+
subject { @vdc.body.networks }
|
|
59
|
+
it_should_behave_like "the mocked tmrk network links"
|
|
60
|
+
end
|
|
61
|
+
describe "#resource_entities" do
|
|
62
|
+
subject { @vdc.body.resource_entities }
|
|
63
|
+
it_should_behave_like "the mocked tmrk resource entity links"
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
context "with a vdc uri that doesn't exist" do
|
|
69
|
+
subject { lambda { @vcloud.get_vdc(URI.parse('https://www.fakey.com/api/v0.8/vdc/999')) } }
|
|
70
|
+
|
|
71
|
+
it_should_behave_like "a request for a resource that doesn't exist"
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Fog::Vcloud do
|
|
4
|
+
subject { Fog::Vcloud.new() }
|
|
5
|
+
|
|
6
|
+
it { should be_an_instance_of Fog::Vcloud::Mock }
|
|
7
|
+
|
|
8
|
+
it { should respond_to :default_organization_uri }
|
|
9
|
+
|
|
10
|
+
it { should respond_to :supported_versions }
|
|
11
|
+
|
|
12
|
+
it { should have_at_least(1).supported_versions }
|
|
13
|
+
|
|
14
|
+
its(:default_organization_uri) { should == URI.parse(@mock_organization[:info][:href]) }
|
|
15
|
+
its(:default_organization_uri) { should be_an_instance_of URI::HTTPS }
|
|
16
|
+
|
|
17
|
+
end
|