fog 0.3.16 → 0.3.17
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/README.rdoc +17 -12
- data/fog.gemspec +10 -5
- data/lib/fog.rb +1 -1
- data/lib/fog/aws/models/storage/directory.rb +22 -0
- data/lib/fog/aws/models/storage/file.rb +15 -0
- data/lib/fog/aws/storage.rb +8 -0
- data/lib/fog/core/collection.rb +9 -8
- data/lib/fog/core/compute.rb +1 -1
- data/lib/fog/google/models/storage/directory.rb +23 -1
- data/lib/fog/google/models/storage/file.rb +16 -1
- data/lib/fog/google/parsers/storage/access_control_list.rb +16 -14
- data/lib/fog/local/models/storage/directory.rb +8 -0
- data/lib/fog/local/models/storage/file.rb +4 -0
- data/lib/fog/rackspace/cdn.rb +3 -3
- data/lib/fog/rackspace/models/storage/directory.rb +18 -0
- data/lib/fog/rackspace/models/storage/file.rb +7 -0
- data/lib/fog/rackspace/requests/cdn/{get_cdn_containers.rb → get_containers.rb} +3 -3
- data/lib/fog/rackspace/requests/cdn/{head_cdn_container.rb → head_container.rb} +3 -3
- data/lib/fog/rackspace/requests/cdn/{put_cdn_container.rb → put_container.rb} +3 -3
- data/lib/fog/rackspace/storage.rb +10 -0
- data/lib/fog/vcloud.rb +32 -153
- data/lib/fog/vcloud/collection.rb +18 -0
- data/lib/fog/vcloud/mock_data_classes.rb +701 -0
- data/lib/fog/vcloud/requests/get_network.rb +8 -8
- data/lib/fog/vcloud/requests/get_organization.rb +10 -10
- data/lib/fog/vcloud/requests/get_vdc.rb +18 -18
- data/lib/fog/vcloud/requests/get_versions.rb +3 -3
- data/lib/fog/vcloud/requests/login.rb +2 -2
- data/lib/fog/vcloud/terremark/ecloud.rb +65 -109
- data/lib/fog/vcloud/terremark/ecloud/models/catalog.rb +1 -0
- data/lib/fog/vcloud/terremark/ecloud/models/firewall_acls.rb +1 -0
- data/lib/fog/vcloud/terremark/ecloud/models/internet_services.rb +1 -0
- data/lib/fog/vcloud/terremark/ecloud/models/ip.rb +1 -1
- data/lib/fog/vcloud/terremark/ecloud/models/ips.rb +1 -0
- data/lib/fog/vcloud/terremark/ecloud/models/network.rb +3 -2
- data/lib/fog/vcloud/terremark/ecloud/models/networks.rb +1 -0
- data/lib/fog/vcloud/terremark/ecloud/models/nodes.rb +1 -0
- data/lib/fog/vcloud/terremark/ecloud/models/public_ips.rb +1 -0
- data/lib/fog/vcloud/terremark/ecloud/models/server.rb +20 -8
- data/lib/fog/vcloud/terremark/ecloud/models/servers.rb +1 -0
- data/lib/fog/vcloud/terremark/ecloud/models/tasks.rb +1 -0
- data/lib/fog/vcloud/terremark/ecloud/models/vdcs.rb +2 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/add_internet_service.rb +4 -8
- data/lib/fog/vcloud/terremark/ecloud/requests/add_node.rb +4 -7
- data/lib/fog/vcloud/terremark/ecloud/requests/configure_internet_service.rb +18 -20
- data/lib/fog/vcloud/terremark/ecloud/requests/configure_node.rb +6 -7
- data/lib/fog/vcloud/terremark/ecloud/requests/configure_vapp.rb +40 -9
- data/lib/fog/vcloud/terremark/ecloud/requests/delete_internet_service.rb +2 -10
- data/lib/fog/vcloud/terremark/ecloud/requests/delete_node.rb +2 -6
- data/lib/fog/vcloud/terremark/ecloud/requests/delete_vapp.rb +13 -1
- data/lib/fog/vcloud/terremark/ecloud/requests/get_catalog.rb +6 -6
- data/lib/fog/vcloud/terremark/ecloud/requests/get_catalog_item.rb +6 -7
- data/lib/fog/vcloud/terremark/ecloud/requests/get_internet_services.rb +34 -33
- data/lib/fog/vcloud/terremark/ecloud/requests/get_network.rb +23 -24
- data/lib/fog/vcloud/terremark/ecloud/requests/get_network_extensions.rb +10 -13
- data/lib/fog/vcloud/terremark/ecloud/requests/get_network_ip.rb +15 -19
- data/lib/fog/vcloud/terremark/ecloud/requests/get_network_ips.rb +20 -22
- data/lib/fog/vcloud/terremark/ecloud/requests/get_node.rb +12 -15
- data/lib/fog/vcloud/terremark/ecloud/requests/get_nodes.rb +11 -12
- data/lib/fog/vcloud/terremark/ecloud/requests/get_public_ip.rb +5 -4
- data/lib/fog/vcloud/terremark/ecloud/requests/get_public_ips.rb +9 -8
- data/lib/fog/vcloud/terremark/ecloud/requests/get_vapp.rb +33 -17
- data/lib/fog/vcloud/terremark/ecloud/requests/get_vdc.rb +54 -53
- data/lib/fog/vcloud/terremark/ecloud/requests/instantiate_vapp_template.rb +13 -19
- data/lib/fog/vcloud/terremark/ecloud/requests/power_off.rb +9 -2
- data/lib/fog/vcloud/terremark/ecloud/requests/power_on.rb +2 -4
- data/spec/vcloud/bin_spec.rb +3 -6
- data/spec/vcloud/models/vdc_spec.rb +8 -8
- data/spec/vcloud/requests/get_network_spec.rb +8 -8
- data/spec/vcloud/requests/get_organization_spec.rb +9 -9
- data/spec/vcloud/requests/get_vdc_spec.rb +7 -7
- data/spec/vcloud/requests/get_versions_spec.rb +1 -1
- data/spec/vcloud/requests/login_spec.rb +2 -2
- data/spec/vcloud/spec_helper.rb +45 -30
- data/spec/vcloud/terremark/ecloud/models/internet_service_spec.rb +10 -14
- data/spec/vcloud/terremark/ecloud/models/ip_spec.rb +5 -8
- data/spec/vcloud/terremark/ecloud/models/ips_spec.rb +2 -2
- data/spec/vcloud/terremark/ecloud/models/network_spec.rb +15 -16
- data/spec/vcloud/terremark/ecloud/models/node_spec.rb +7 -7
- data/spec/vcloud/terremark/ecloud/models/nodes_spec.rb +1 -1
- data/spec/vcloud/terremark/ecloud/models/public_ip_spec.rb +4 -8
- data/spec/vcloud/terremark/ecloud/models/server_spec.rb +42 -0
- data/spec/vcloud/terremark/ecloud/models/vdc_spec.rb +7 -7
- data/spec/vcloud/terremark/ecloud/models/vdcs_spec.rb +1 -1
- data/spec/vcloud/terremark/ecloud/requests/add_internet_service_spec.rb +13 -18
- data/spec/vcloud/terremark/ecloud/requests/add_node_spec.rb +9 -5
- data/spec/vcloud/terremark/ecloud/requests/configure_internet_service_spec.rb +5 -7
- data/spec/vcloud/terremark/ecloud/requests/configure_node_spec.rb +22 -28
- data/spec/vcloud/terremark/ecloud/requests/configure_vapp_spec.rb +71 -0
- data/spec/vcloud/terremark/ecloud/requests/delete_internet_service_spec.rb +7 -9
- data/spec/vcloud/terremark/ecloud/requests/delete_node_spec.rb +3 -7
- data/spec/vcloud/terremark/ecloud/requests/delete_vapp_spec.rb +83 -0
- data/spec/vcloud/terremark/ecloud/requests/get_catalog_item_spec.rb +6 -5
- data/spec/vcloud/terremark/ecloud/requests/get_catalog_spec.rb +2 -2
- data/spec/vcloud/terremark/ecloud/requests/get_internet_services_spec.rb +31 -42
- data/spec/vcloud/terremark/ecloud/requests/get_network_ip_spec.rb +4 -7
- data/spec/vcloud/terremark/ecloud/requests/get_network_ips_spec.rb +1 -1
- data/spec/vcloud/terremark/ecloud/requests/get_network_spec.rb +19 -11
- data/spec/vcloud/terremark/ecloud/requests/get_node_spec.rb +8 -8
- data/spec/vcloud/terremark/ecloud/requests/get_nodes_spec.rb +11 -11
- data/spec/vcloud/terremark/ecloud/requests/get_public_ip_spec.rb +4 -5
- data/spec/vcloud/terremark/ecloud/requests/get_public_ips_spec.rb +6 -6
- data/spec/vcloud/terremark/ecloud/requests/get_vapp_spec.rb +36 -19
- data/spec/vcloud/terremark/ecloud/requests/get_vdc_spec.rb +21 -18
- data/spec/vcloud/terremark/ecloud/requests/instantiate_vapp_template_spec.rb +27 -17
- data/spec/vcloud/terremark/ecloud/requests/power_off_spec.rb +34 -0
- data/spec/vcloud/terremark/ecloud/requests/power_on_spec.rb +3 -4
- data/spec/vcloud/vcloud_spec.rb +2 -2
- data/tests/helpers/storage/directory_tests.rb +8 -0
- data/tests/helpers/storage/file_tests.rb +4 -0
- metadata +11 -6
@@ -9,26 +9,24 @@ if Fog.mocking?
|
|
9
9
|
|
10
10
|
describe "#delete_internet_service" do
|
11
11
|
context "with a valid internet service uri" do
|
12
|
-
subject { @vcloud.delete_internet_service(@mock_service
|
12
|
+
subject { @vcloud.delete_internet_service(@mock_service.href) }
|
13
13
|
|
14
14
|
it_should_behave_like "all delete responses"
|
15
15
|
|
16
|
-
let(:public_ip) { @vcloud.vdcs.first.public_ips.
|
16
|
+
let(:public_ip) { @vcloud.vdcs.first.public_ips.detect {|i| i.name == @mock_public_ip.name } }
|
17
|
+
|
18
|
+
it "should change the mock data" do
|
19
|
+
expect { subject }.to change { @mock_public_ip.internet_service_collection.items.count }.by(-1)
|
20
|
+
end
|
17
21
|
|
18
22
|
it "should change the count by -1" do
|
19
|
-
public_ip.internet_services.length.
|
20
|
-
subject
|
21
|
-
public_ip.internet_services.reload.length.should == 1
|
23
|
+
expect { subject }.to change { public_ip.reload.internet_services.reload.length }.by(-1)
|
22
24
|
end
|
23
25
|
|
24
26
|
describe "#body" do
|
25
27
|
its(:body) { should == '' }
|
26
28
|
end
|
27
|
-
|
28
|
-
|
29
|
-
|
30
29
|
end
|
31
|
-
|
32
30
|
end
|
33
31
|
end
|
34
32
|
else
|
@@ -9,16 +9,12 @@ if Fog.mocking?
|
|
9
9
|
|
10
10
|
describe "#delete_node" do
|
11
11
|
context "with a valid node service uri" do
|
12
|
-
subject { @vcloud.delete_node(@mock_node
|
12
|
+
subject { @vcloud.delete_node(@mock_node.href) }
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
let(:internet_service) { @vcloud.vdcs.first.public_ips.first.internet_services.first }
|
14
|
+
it_should_behave_like "all delete responses"
|
17
15
|
|
18
16
|
it "should change the count by -1" do
|
19
|
-
|
20
|
-
subject
|
21
|
-
internet_service.nodes.reload.length.should == 1
|
17
|
+
expect { subject }.to change { @vcloud.get_nodes(@mock_node_collection.href).body[:NodeService].length }.by(-1)
|
22
18
|
end
|
23
19
|
end
|
24
20
|
|
@@ -0,0 +1,83 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), '..', '..', '..', 'spec_helper')
|
2
|
+
|
3
|
+
shared_examples_for "a failed vapp deletion" do
|
4
|
+
it "should not change the mock data" do
|
5
|
+
expect { subject }.to change { @mock_vdc.virtual_machines.count }.by(0)
|
6
|
+
end
|
7
|
+
|
8
|
+
it "should not change the model data" do
|
9
|
+
expect { subject }.to change { vdc.reload.servers.reload.count }.by(0)
|
10
|
+
end
|
11
|
+
|
12
|
+
describe "#body" do
|
13
|
+
its(:body) { should == '' }
|
14
|
+
end
|
15
|
+
|
16
|
+
describe "#headers" do
|
17
|
+
its(:headers) { should_not include "Location" }
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
#FIXME: Make this more sane with rspec2
|
22
|
+
if Fog.mocking?
|
23
|
+
describe "Fog::Vcloud, initialized w/ the TMRK Ecloud module", :type => :mock_tmrk_ecloud_request do
|
24
|
+
subject { @vcloud }
|
25
|
+
|
26
|
+
it { should respond_to :delete_vapp }
|
27
|
+
|
28
|
+
describe "#delete_vapp" do
|
29
|
+
context "with a valid vapp uri" do
|
30
|
+
subject { @vcloud.delete_vapp(@mock_vm.href) }
|
31
|
+
let(:vdc) { @vcloud.vdcs.first }
|
32
|
+
|
33
|
+
context "when there are no internet service nodes attached" do
|
34
|
+
it_should_behave_like "all delete responses"
|
35
|
+
|
36
|
+
it "should change the mock data" do
|
37
|
+
expect { subject }.to change { @mock_vdc.virtual_machines.count }.by(-1)
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should change the model data" do
|
41
|
+
expect { subject }.to change { vdc.reload.servers.reload.count }.by(-1)
|
42
|
+
end
|
43
|
+
|
44
|
+
describe "#body" do
|
45
|
+
its(:body) { should == '' }
|
46
|
+
end
|
47
|
+
|
48
|
+
describe "#headers" do
|
49
|
+
its(:headers) { should include "Location" }
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
context "when there are internet service nodes attached" do
|
54
|
+
before do
|
55
|
+
vdc.public_ips.first.internet_services.create(:name => "#{@mock_vm.name} service", :port => 1231, :protocol => "TCP", :description => "", :enabled => true).tap do |internet_service|
|
56
|
+
internet_service.nodes.create(:name => "#{@mock_vm.name} node", :port => 1231, :description => "", :enabled => true, :ip_address => @mock_vm.ip)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
it_should_behave_like "all delete responses"
|
61
|
+
it_should_behave_like "a failed vapp deletion"
|
62
|
+
end
|
63
|
+
|
64
|
+
context "when the VM is powered on" do
|
65
|
+
before do
|
66
|
+
@mock_vm.power_on!
|
67
|
+
end
|
68
|
+
|
69
|
+
it_should_behave_like "all delete responses"
|
70
|
+
it_should_behave_like "a failed vapp deletion"
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
context "with a vapp uri that doesn't exist" do
|
75
|
+
subject { lambda { @vcloud.delete_vapp(URI.parse('https://www.fakey.c/piv8vc99')) } }
|
76
|
+
|
77
|
+
it_should_behave_like "a request for a resource that doesn't exist"
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
else
|
82
|
+
end
|
83
|
+
|
@@ -10,7 +10,7 @@ if Fog.mocking?
|
|
10
10
|
context "with a valid catalog_item_uri" do
|
11
11
|
before { @catalog_item = @vcloud.get_catalog_item(@vcloud.vdcs.first.catalog.first.href) }
|
12
12
|
subject { @catalog_item }
|
13
|
-
let(:
|
13
|
+
let(:mock_data_catalog_item) { @mock_data.catalog_item_from_href(@catalog_item.body[:href]) }
|
14
14
|
|
15
15
|
it_should_behave_like "all responses"
|
16
16
|
it { should have_headers_denoting_a_content_type_of "application/vnd.vmware.vcloud.catalogItem+xml" }
|
@@ -30,12 +30,13 @@ if Fog.mocking?
|
|
30
30
|
|
31
31
|
describe "Entity" do
|
32
32
|
subject { @catalog_item.body[:Entity] }
|
33
|
+
let(:mock_data_catalog_item) { @mock_data.catalog_item_from_href(@catalog_item.body[:href]) }
|
33
34
|
|
34
35
|
it { should have(3).items }
|
35
36
|
|
36
|
-
its(:name) { should ==
|
37
|
+
its(:name) { should == mock_data_catalog_item.name }
|
37
38
|
its(:type) { should == "application/vnd.vmware.vcloud.vAppTemplate+xml" }
|
38
|
-
its(:href) { should ==
|
39
|
+
its(:href) { should == mock_data_catalog_item.vapp_template.href }
|
39
40
|
end
|
40
41
|
|
41
42
|
describe "Link" do
|
@@ -44,8 +45,8 @@ if Fog.mocking?
|
|
44
45
|
it { should have(4).items }
|
45
46
|
|
46
47
|
its(:rel) { should == "down" }
|
47
|
-
its(:href) { should ==
|
48
|
-
its(:name) { should ==
|
48
|
+
its(:href) { should == mock_data_catalog_item.customization.href }
|
49
|
+
its(:name) { should == mock_data_catalog_item.customization.name }
|
49
50
|
its(:type) { should == "application/vnd.tmrk.ecloud.catalogItemCustomizationParameters+xml" }
|
50
51
|
end
|
51
52
|
end
|
@@ -8,7 +8,7 @@ if Fog.mocking?
|
|
8
8
|
|
9
9
|
describe "#get_catalog" do
|
10
10
|
context "with a valid vdc catalog_uri" do
|
11
|
-
before { @catalog = @vcloud.get_catalog(@mock_vdc
|
11
|
+
before { @catalog = @vcloud.get_catalog(@mock_vdc.catalog.href) }
|
12
12
|
subject { @catalog }
|
13
13
|
|
14
14
|
it_should_behave_like "all responses"
|
@@ -21,7 +21,7 @@ if Fog.mocking?
|
|
21
21
|
|
22
22
|
it_should_behave_like "it has the standard vcloud v0.8 xmlns attributes" # 3 keys
|
23
23
|
|
24
|
-
its(:name) { should ==
|
24
|
+
its(:name) { should == @mock_vdc.catalog.name }
|
25
25
|
|
26
26
|
it { should include :CatalogItems }
|
27
27
|
|
@@ -1,6 +1,28 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__), '..', '..', '..', 'spec_helper')
|
2
2
|
|
3
3
|
if Fog.mocking?
|
4
|
+
shared_examples_for "the expected internet service item" do
|
5
|
+
specify { service.should be_an_instance_of Hash }
|
6
|
+
specify { service.should have(11).attributes }
|
7
|
+
specify { service[:Name].should == mock_service.name }
|
8
|
+
specify { service[:Id].should == mock_service.object_id.to_s }
|
9
|
+
specify { service[:Href].should == mock_service.href }
|
10
|
+
|
11
|
+
specify { service[:PublicIpAddress].should be_an_instance_of Hash }
|
12
|
+
specify { service[:PublicIpAddress].should have(3).attributes }
|
13
|
+
specify { service[:PublicIpAddress][:Name].should == mock_ip.name }
|
14
|
+
specify { service[:PublicIpAddress][:Href].should == mock_ip.href }
|
15
|
+
specify { service[:PublicIpAddress][:Id].should == mock_ip.object_id.to_s }
|
16
|
+
|
17
|
+
specify { service[:Port].should == mock_service.port.to_s }
|
18
|
+
specify { service[:Protocol].should == mock_service.protocol }
|
19
|
+
specify { service[:Enabled].should == mock_service.enabled.to_s }
|
20
|
+
specify { service[:Timeout].should == mock_service.timeout.to_s }
|
21
|
+
specify { service[:Description].should == mock_service.description }
|
22
|
+
specify { service[:RedirectURL].should == (mock_service.redirect_url || "") }
|
23
|
+
specify { service[:Monitor].should == "" }
|
24
|
+
end
|
25
|
+
|
4
26
|
describe "Fog::Vcloud, initialized w/ the TMRK Ecloud module", :type => :mock_tmrk_ecloud_request do
|
5
27
|
subject { @vcloud }
|
6
28
|
|
@@ -8,7 +30,7 @@ if Fog.mocking?
|
|
8
30
|
|
9
31
|
describe "#get_internet_services" do
|
10
32
|
context "with a valid VDC internet_services_uri" do
|
11
|
-
before { @services = @vcloud.get_internet_services(
|
33
|
+
before { @services = @vcloud.get_internet_services(@mock_vdc_service_collection.href) }
|
12
34
|
subject { @services }
|
13
35
|
|
14
36
|
it_should_behave_like "all responses"
|
@@ -29,26 +51,10 @@ if Fog.mocking?
|
|
29
51
|
|
30
52
|
[0,1,2,3].each do |idx|
|
31
53
|
let(:service) { subject[idx] }
|
32
|
-
let(:mock_service) { @mock_vdc
|
33
|
-
let(:mock_ip) {
|
34
|
-
|
35
|
-
|
36
|
-
specify { service[:Name].should == mock_service[:name] }
|
37
|
-
specify { service[:Id].should == mock_service[:id] }
|
38
|
-
specify { service[:Href].should == Fog::Vcloud::Terremark::Ecloud::Mock.internet_service_href(mock_service) }
|
39
|
-
|
40
|
-
specify { service[:PublicIpAddress].should be_an_instance_of Hash }
|
41
|
-
specify { service[:PublicIpAddress].should have(3).attributes }
|
42
|
-
specify { service[:PublicIpAddress][:Name].should == mock_ip[:name] }
|
43
|
-
specify { service[:PublicIpAddress][:Id].should == mock_ip[:id] }
|
44
|
-
|
45
|
-
specify { service[:Port].should == mock_service[:port] }
|
46
|
-
specify { service[:Protocol].should == mock_service[:protocol] }
|
47
|
-
specify { service[:Enabled].should == mock_service[:enabled] }
|
48
|
-
specify { service[:Timeout].should == mock_service[:timeout] }
|
49
|
-
specify { service[:Description].should == mock_service[:description] }
|
50
|
-
specify { service[:RedirectURL].should == mock_service[:redirect_url] }
|
51
|
-
specify { service[:Monitor].should == "" }
|
54
|
+
let(:mock_service) { @mock_vdc.public_ip_collection.items.map {|ip| ip.internet_service_collection.items }.flatten[idx] }
|
55
|
+
let(:mock_ip) { mock_service._parent._parent }
|
56
|
+
|
57
|
+
it_should_behave_like "the expected internet service item"
|
52
58
|
end
|
53
59
|
end
|
54
60
|
end
|
@@ -56,8 +62,7 @@ if Fog.mocking?
|
|
56
62
|
|
57
63
|
context "with a valid Public IP uri" do
|
58
64
|
before do
|
59
|
-
@
|
60
|
-
@services = @vcloud.get_internet_services( @mock_public_ip[:href] + "/internetServices" )
|
65
|
+
@services = @vcloud.get_internet_services(@mock_service_collection.href)
|
61
66
|
end
|
62
67
|
subject { @services }
|
63
68
|
|
@@ -79,26 +84,10 @@ if Fog.mocking?
|
|
79
84
|
|
80
85
|
[0,1].each do |idx|
|
81
86
|
let(:service) { subject[idx] }
|
82
|
-
let(:mock_service) { @
|
87
|
+
let(:mock_service) { @mock_service_collection.items[idx] }
|
83
88
|
let(:mock_ip) { @mock_public_ip }
|
84
|
-
|
85
|
-
|
86
|
-
specify { service[:Name].should == mock_service[:name] }
|
87
|
-
specify { service[:Id].should == mock_service[:id] }
|
88
|
-
specify { service[:Href].should == Fog::Vcloud::Terremark::Ecloud::Mock.internet_service_href(mock_service) }
|
89
|
-
|
90
|
-
specify { service[:PublicIpAddress].should be_an_instance_of Hash }
|
91
|
-
specify { service[:PublicIpAddress].should have(3).attributes }
|
92
|
-
specify { service[:PublicIpAddress][:Name].should == mock_ip[:name] }
|
93
|
-
specify { service[:PublicIpAddress][:Id].should == mock_ip[:id] }
|
94
|
-
|
95
|
-
specify { service[:Port].should == mock_service[:port] }
|
96
|
-
specify { service[:Protocol].should == mock_service[:protocol] }
|
97
|
-
specify { service[:Enabled].should == mock_service[:enabled] }
|
98
|
-
specify { service[:Timeout].should == mock_service[:timeout] }
|
99
|
-
specify { service[:Description].should == mock_service[:description] }
|
100
|
-
specify { service[:RedirectURL].should == mock_service[:redirect_url] }
|
101
|
-
specify { service[:Monitor].should == "" }
|
89
|
+
|
90
|
+
it_should_behave_like "the expected internet service item"
|
102
91
|
end
|
103
92
|
end
|
104
93
|
end
|
@@ -9,10 +9,7 @@ if Fog.mocking?
|
|
9
9
|
describe "#get_network_ip" do
|
10
10
|
context "with a valid ip_uri" do
|
11
11
|
before do
|
12
|
-
@
|
13
|
-
@mock_ip = @mock_network[:ips].keys.first
|
14
|
-
@mock_ip_href = "#{Fog::Vcloud::Terremark::Ecloud::Mock.extension_url}/ip/#{@mock_ip.gsub('.','')}"
|
15
|
-
@ip = @vcloud.get_network_ip( @mock_ip_href )
|
12
|
+
@ip = @vcloud.get_network_ip(@mock_network_ip.href)
|
16
13
|
end
|
17
14
|
|
18
15
|
subject { @ip }
|
@@ -23,9 +20,9 @@ if Fog.mocking?
|
|
23
20
|
describe "#body" do
|
24
21
|
subject { @ip.body }
|
25
22
|
|
26
|
-
its(:Name) { should == @
|
27
|
-
its(:Href) { should == @
|
28
|
-
its(:Id) { should == @
|
23
|
+
its(:Name) { should == @mock_network_ip.name }
|
24
|
+
its(:Href) { should == @mock_network_ip.href }
|
25
|
+
its(:Id) { should == @mock_network_ip.object_id.to_s }
|
29
26
|
|
30
27
|
end
|
31
28
|
end
|
@@ -8,7 +8,7 @@ if Fog.mocking?
|
|
8
8
|
|
9
9
|
describe "#get_network_ips" do
|
10
10
|
context "with a valid VDC network ips_uri" do
|
11
|
-
before { @ips = @vcloud.get_network_ips(
|
11
|
+
before { @ips = @vcloud.get_network_ips(@mock_network_ip_collection.href) }
|
12
12
|
subject { @ips }
|
13
13
|
|
14
14
|
it_should_behave_like "all responses"
|
@@ -1,35 +1,43 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__), '..', '..', '..', 'spec_helper')
|
2
2
|
|
3
3
|
if Fog.mocking?
|
4
|
-
describe Fog::Vcloud, :type => :mock_tmrk_ecloud_request do
|
4
|
+
describe "Fog::Vcloud, initialized w/ the TMRK Ecloud module", :type => :mock_tmrk_ecloud_request do
|
5
5
|
subject { @vcloud }
|
6
6
|
|
7
7
|
it { should respond_to :get_network }
|
8
8
|
|
9
|
-
describe
|
9
|
+
describe "#get_network" do
|
10
10
|
context "with a valid network uri" do
|
11
|
-
before { @network = @vcloud.get_network(
|
11
|
+
before { @network = @vcloud.get_network(@mock_network.href) }
|
12
12
|
subject { @network }
|
13
13
|
|
14
14
|
it_should_behave_like "all responses"
|
15
15
|
it { should have_headers_denoting_a_content_type_of "application/vnd.vmware.vcloud.network+xml" }
|
16
16
|
|
17
|
-
describe
|
17
|
+
describe "#body" do
|
18
18
|
subject { @network.body }
|
19
19
|
|
20
20
|
it { should have(9).keys }
|
21
21
|
|
22
22
|
it_should_behave_like "it has the standard vcloud v0.8 xmlns attributes" # 3 keys
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
24
|
+
its(:type) { should == "application/vnd.vmware.vcloud.network+xml" }
|
25
|
+
its(:Features) { should == @mock_network.features.map {|f| { f[:type] => f[:value] } }.first }
|
26
|
+
its(:href) { should == @mock_network.href }
|
27
|
+
its(:name) { should == @mock_network.name }
|
28
|
+
its(:Configuration) { should == { :Gateway => @mock_network.gateway, :Netmask => @mock_network.netmask } }
|
29
|
+
its(:Link) { should ==
|
30
|
+
[{:type => "application/xml",
|
31
|
+
:rel => "down",
|
32
|
+
:href => @mock_network_ip_collection.href,
|
33
|
+
:name => "IP Addresses"},
|
34
|
+
{:type => "application/xml",
|
35
|
+
:rel => "down",
|
36
|
+
:href => @mock_network_extensions.href,
|
37
|
+
:name => @mock_network_extensions.name}]}
|
31
38
|
end
|
32
39
|
end
|
40
|
+
|
33
41
|
context "with a network uri that doesn't exist" do
|
34
42
|
subject { lambda { @vcloud.get_network(URI.parse('https://www.fakey.com/api/v0.8/network/999')) } }
|
35
43
|
it_should_behave_like "a request for a resource that doesn't exist"
|
@@ -8,7 +8,7 @@ if Fog.mocking?
|
|
8
8
|
|
9
9
|
describe "#get_node" do
|
10
10
|
context "with a valid nodes_uri" do
|
11
|
-
before { @node = @vcloud.get_node(@mock_node
|
11
|
+
before { @node = @vcloud.get_node(@mock_node.href) }
|
12
12
|
subject { @node }
|
13
13
|
|
14
14
|
it_should_behave_like "all responses"
|
@@ -19,13 +19,13 @@ if Fog.mocking?
|
|
19
19
|
|
20
20
|
it { should have(9).keys }
|
21
21
|
|
22
|
-
its(:Href) { should == @mock_node
|
23
|
-
its(:Id) { should == @mock_node
|
24
|
-
its(:Name) { should == @mock_node
|
25
|
-
its(:Enabled) { should == @mock_node
|
26
|
-
its(:Port) { should == @mock_node
|
27
|
-
its(:Description) { should == @mock_node
|
28
|
-
its(:IpAddress) { should == @mock_node
|
22
|
+
its(:Href) { should == @mock_node.href }
|
23
|
+
its(:Id) { should == @mock_node.object_id.to_s }
|
24
|
+
its(:Name) { should == @mock_node.name }
|
25
|
+
its(:Enabled) { should == @mock_node.enabled.to_s }
|
26
|
+
its(:Port) { should == @mock_node.port.to_s }
|
27
|
+
its(:Description) { should == @mock_node.description }
|
28
|
+
its(:IpAddress) { should == @mock_node.ip_address }
|
29
29
|
|
30
30
|
end
|
31
31
|
end
|
@@ -8,7 +8,7 @@ if Fog.mocking?
|
|
8
8
|
|
9
9
|
describe "#get_nodes" do
|
10
10
|
context "with a valid nodes_uri" do
|
11
|
-
before { @nodes = @vcloud.get_nodes(@
|
11
|
+
before { @nodes = @vcloud.get_nodes(@mock_node_collection.href) }
|
12
12
|
subject { @nodes }
|
13
13
|
|
14
14
|
it_should_behave_like "all responses"
|
@@ -22,22 +22,22 @@ if Fog.mocking?
|
|
22
22
|
describe "[:NodeService]" do
|
23
23
|
subject { @nodes.body[:NodeService] }
|
24
24
|
|
25
|
-
it { should have(@
|
25
|
+
it { should have(@mock_node_collection.items.length).nodes }
|
26
26
|
|
27
27
|
[0,1].each do |idx|
|
28
28
|
|
29
29
|
context "[#{idx}]" do
|
30
30
|
subject { @nodes.body[:NodeService][idx] }
|
31
|
-
let(:mock_node) { @
|
32
|
-
let(:keys) { subject.keys.
|
31
|
+
let(:mock_node) { @mock_node_collection.items[idx] }
|
32
|
+
let(:keys) { subject.keys.sort_by(&:to_s) }
|
33
33
|
specify { keys.should == [:Description, :Enabled, :Href, :Id, :IpAddress, :Name, :Port] }
|
34
|
-
its(:Href) { should == mock_node
|
35
|
-
its(:Id) { should == mock_node
|
36
|
-
its(:Name) { should == mock_node
|
37
|
-
its(:Enabled) { should == mock_node
|
38
|
-
its(:Port) { should == mock_node
|
39
|
-
its(:IpAddress) { should == mock_node
|
40
|
-
its(:Description) { should == mock_node
|
34
|
+
its(:Href) { should == mock_node.href }
|
35
|
+
its(:Id) { should == mock_node.object_id.to_s }
|
36
|
+
its(:Name) { should == mock_node.name }
|
37
|
+
its(:Enabled) { should == mock_node.enabled.to_s }
|
38
|
+
its(:Port) { should == mock_node.port.to_s }
|
39
|
+
its(:IpAddress) { should == mock_node.ip_address }
|
40
|
+
its(:Description) { should == mock_node.description }
|
41
41
|
end
|
42
42
|
|
43
43
|
end
|