initial work toward flattening Vcloud::Terremark::Ecloud namespace

This commit is contained in:
geemus 2011-02-16 16:13:09 -08:00
parent fadb437255
commit b6af64d76a
26 changed files with 154 additions and 614 deletions

View File

@ -70,6 +70,5 @@ require 'fog/bin/new_servers'
require 'fog/bin/rackspace'
require 'fog/bin/slicehost'
require 'fog/bin/terremark'
require 'fog/bin/terremark_ecloud'
require 'fog/bin/vcloud'
require 'fog/bin/zerigo'

View File

@ -16,5 +16,4 @@ require 'fog/providers/local'
require 'fog/providers/new_servers'
require 'fog/providers/rackspace'
require 'fog/providers/slicehost'
require 'fog/providers/terremark_ecloud'
require 'fog/providers/zerigo'

View File

@ -25,15 +25,8 @@ module Fog
recognizes :version, :persistent
model_path 'fog/vcloud/models'
model :vdc
collection :vdcs
request_path 'fog/vcloud/requests'
request :login
request :get_versions
request :get_vdc
request :get_organization
request :get_network
class UnsupportedVersion < Exception ; end
@ -334,4 +327,3 @@ module Fog
end
require 'fog/vcloud/terremark/ecloud'
require 'fog/vcloud/terremark/vcloud'

View File

@ -1,26 +0,0 @@
module Fog
class Vcloud
class Vdc < Fog::Vcloud::Model
identity :href
ignore_attributes :xmlns, :xmlns_xsi, :xmlns_xsd
attribute :name
attribute :type
attribute :description, :aliases => :Description
attribute :other_links, :aliases => :Link
attribute :compute_capacity, :aliases => :ComputeCapacity
attribute :storage_capacity, :aliases => :StorageCapacity
attribute :available_networks, :aliases => :AvailableNetworks, :squash => :Network
attribute :resource_entities, :aliases => :ResourceEntities, :squash => :ResourceEntity
attribute :enabled, :aliases => :IsEnabled
attribute :vm_quota, :aliases => :VmQuota
attribute :nic_quota, :aliases => :NicQuota
attribute :network_quota, :aliases => :NetworkQuota
attribute :allocation_model, :aliases => :AllocationModel
end
end
end

View File

@ -1,35 +0,0 @@
require 'fog/vcloud/models/vdc'
module Fog
class Vcloud
class Vdcs < Fog::Vcloud::Collection
model Fog::Vcloud::Vdc
def all
data = connection.get_organization(organization_uri).body[:Link].select { |link| link[:type] == "application/vnd.vmware.vcloud.vdc+xml" }
data.each { |link| link.delete_if { |key, value| [:rel].include?(key) } }
load(data)
end
def get(uri)
if data = connection.get_vdc(uri)
new(data.body)
end
rescue Fog::Errors::NotFound
nil
end
def organization_uri
@organizatio_uri ||= connection.default_organization_uri
end
private
def organization_uri=(new_organization_uri)
@organization_uri = new_organization_uri
end
end
end
end

View File

@ -1,47 +0,0 @@
module Fog
class Vcloud
class Real
basic_request :get_network
end
class Mock
def get_network(network_uri)
#
# Based off of:
# vCloud API Guide v0.8 - Page 50
#
# Did not implement AssociatedNetwork, seems redundant, haven't seen it in use yet
# Did not implement the following features: Dhcp, Nat & Firewall
#
network_uri = ensure_unparsed(network_uri)
type = "application/vnd.vmware.vcloud.network+xml"
response = Excon::Response.new
if network = mock_data.organizations.map { |org| org.vdcs.map { |vdc| vdc.networks } }.flatten.detect { |network| network.href == network_uri.to_s }
xml = Builder::XmlMarkup.new
mock_it 200,
xml.Network(xmlns.merge(:href => network.href, :name => network.name, :type => type)) {
xml.Description(network.name)
xml.Configuration {
xml.Gateway(network.gateway)
xml.Netmask(network.netmask)
xml.Dns(network.dns)
}
if network.features
xml.Features {
if feature = network.features.detect { |feature| feature[:type] == :FenceMode }
xml.FenceMode(feature[:value])
end
}
end
},
{ 'Content-Type' => type }
else
mock_error 200, "401 Unauthorized"
end
end
end
end
end

View File

@ -1,47 +0,0 @@
module Fog
class Vcloud
class Real
basic_request :get_organization
end
class Mock
def get_organization(organization_uri)
#
# Based off of:
# http://support.theenterprisecloud.com/kb/default.asp?id=540&Lang=1&SID=
#
# vCloud API Guide v0.9 - Page 26
#
organization_uri = ensure_unparsed(organization_uri)
if organization = mock_data.organization_from_href(organization_uri)
xml = Builder::XmlMarkup.new
mock_it 200,
xml.Org(xmlns.merge(:href => organization.href, :name => organization.name)) {
organization.vdcs.each do |vdc|
xml.Link(:rel => "down",
:href => vdc.href,
:type => "application/vnd.vmware.vcloud.vdc+xml",
:name => vdc.name)
xml.Link(:rel => "down",
:href => vdc.catalog.href,
:type => "application/vnd.vmware.vcloud.catalog+xml",
:name => vdc.catalog.name)
xml.Link(:rel => "down",
:href => vdc.task_list.href,
:type => "application/vnd.vmware.vcloud.tasksList+xml",
:name => vdc.task_list.name)
end
},
{'Content-Type' => "application/vnd.vmware.vcloud.org+xml" }
else
mock_error 200, "401 Unauthorized"
end
end
end
end
end

View File

@ -1,82 +0,0 @@
module Fog
class Vcloud
class Real
basic_request :get_vdc
end
class Mock
# WARNING: Incomplete
#Based off of:
#vCloud API Guide v0.9 - Page 27
def get_vdc(vdc_uri)
vdc_uri = ensure_unparsed(vdc_uri)
if vdc = mock_data.organizations.map { |org| org.vdcs }.flatten.detect { |vdc| vdc.href == vdc_uri }
xml = Builder::XmlMarkup.new
mock_it 200,
xml.Vdc(xmlns.merge(:href => vdc.href, :name => vdc.name)) {
xml.Link(:rel => "up",
:href => mock_data.organizations.detect { |org| org.vdcs.detect { |_vdc| vdc.href == _vdc.href }.href == vdc.href }.href,
:type => "application/vnd.vmware.vcloud.org+xml")
xml.Link(:rel => "add",
:href => vdc.href + "/action/uploadVAppTemplate",
:type => "application/vnd.vmware.vcloud.uploadVAppTemplateParams+xml")
xml.Link(:rel => "add",
:href => vdc.href + "/media",
:type => "application/vnd.vmware.vcloud.media+xml")
xml.Link(:rel => "add",
:href => vdc.href + "/action/instantiateVAppTemplate",
:type => "application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml")
xml.Link(:rel => "add",
:type => "application/vnd.vmware.vcloud.cloneVAppParams+xml",
:href => vdc.href + "/action/cloneVApp")
xml.Link(:rel => "add",
:type => "application/vnd.vmware.vcloud.captureVAppParams+xml",
:href => vdc.href + "/action/captureVApp")
xml.Link(:rel => "add",
:type => "application/vnd.vmware.vcloud.composeVAppParams+xml",
:href => vdc.href + "/action/composeVApp")
xml.AllocationModel("AllocationPool")
xml.Description(vdc[:name] + " VDC")
xml.ResourceEntities {
mock_data.organizations.first.vdcs.first.virtual_machines.each do |resource|
xml.ResourceEntity(resource)
end
}
xml.AvailableNetworks {
vdc.networks.each do |network|
xml.Network( :name => network.name, :href => network.href, :type => "application/vnd.vmware.vcloud.network+xml" )
end
}
xml.ComputeCapacity{
xml.Cpu {
xml.Units("Mhz")
xml.Allocated(vdc.cpu_allocated)
xml.Limit(vdc.cpu_allocated)
}
xml.Memory {
xml.Units("MB")
xml.Allocated(vdc.memory_allocated)
xml.Limit(vdc.memory_allocated)
}
}
xml.StorageCapacity{
xml.Units("MB")
xml.Allocated(vdc.storage_allocated)
xml.Limit(vdc.storage_allocated)
}
xml.VmQuota(0)
xml.NicQuota(0)
xml.IsEnabled('true')
xml.NetworkQuota(0)
#FIXME: Incomplete
}, { 'Content-Type' => 'application/vnd.vmware.vcloud.vdc+xml' }
else
mock_error 200, "401 Unauthorized"
end
end
end
end
end

View File

@ -1,34 +0,0 @@
module Fog
class Vcloud
class Real
unauthenticated_basic_request :get_versions
end
class Mock
def get_versions(versions_uri)
#
# Based off of:
# http://support.theenterprisecloud.com/kb/default.asp?id=535&Lang=1&SID=
# https://community.vcloudexpress.terremark.com/en-us/product_docs/w/wiki/02-get-versions.aspx
# vCloud API Guide v0.9 - Page 89
#
xml = Builder::XmlMarkup.new
mock_it 200,
xml.SupportedVersions( xmlns.merge("xmlns" => "http://www.vmware.com/vcloud/versions")) {
mock_data.versions.select {|version| version.supported }.each do |version|
xml.VersionInfo {
xml.Version(version.version)
xml.LoginUrl(version.login_url)
}
end
}
end
end
end
end

View File

@ -1,46 +0,0 @@
module Fog
class Vcloud
class Real
def login
unauthenticated_request({
:expects => 200,
:headers => {
'Authorization' => authorization_header
},
:method => 'POST',
:parse => true,
:uri => login_uri
})
end
end
class Mock
def login
#
# Based off of:
# http://support.theenterprisecloud.com/kb/default.asp?id=536&Lang=1&SID=
# https://community.vcloudexpress.terremark.com/en-us/product_docs/w/wiki/01-get-login-token.aspx
# vCloud API Guide v0.9 - Page 17
#
xml = Builder::XmlMarkup.new
mock_it 200,
xml.OrgList(xmlns) {
mock_data.organizations.each do |organization|
xml.Org( :type => "application/vnd.vmware.vcloud.org+xml", :href => organization.href, :name => organization.name )
end
},
{ 'Set-Cookie' => 'vcloud-token=fc020a05-21d7-4f33-9b2a-25d8cd05a44e; path=/',
'Content-Type' => 'application/vnd.vmware.vcloud.orgslist+xml' }
end
end
end
end

View File

@ -53,6 +53,7 @@ module Fog
request :get_network_ip
request :get_network_ips
request :get_network_extensions
request :get_organization
request :get_node
request :get_nodes
request :get_public_ip
@ -62,7 +63,9 @@ module Fog
request :get_vapp
request :get_vapp_template
request :get_vdc
request :get_versions
request :instantiate_vapp_template
request :login
request :power_off
request :power_on
request :power_reset
@ -95,7 +98,7 @@ module Fog
def self.data( base_url = self.base_url )
@mock_data ||= Fog::Vcloud::Mock.data(base_url).tap do |vcloud_mock_data|
vcloud_mock_data.versions.clear
vcloud_mock_data.versions << MockVersion.new(:version => "v0.8b-ext2.6")
vcloud_mock_data.versions << MockVersion.new(:version => "v0.8b-ext2.6", :supported => true)
vcloud_mock_data.organizations.detect {|o| o.name == "Boom Inc." }.tap do |mock_organization|
mock_organization.vdcs.detect {|v| v.name == "Boomstick" }.tap do |mock_vdc|

View File

@ -4,7 +4,7 @@ module Fog
class Ecloud
class Real
# Handled by the main Vcloud get_network
basic_request :get_network
end
class Mock

View File

@ -0,0 +1,52 @@
module Fog
class Vcloud
module Terremark
class Ecloud
class Real
basic_request :get_organization
end
class Mock
def get_organization(organization_uri)
#
# Based off of:
# http://support.theenterprisecloud.com/kb/default.asp?id=540&Lang=1&SID=
#
# vCloud API Guide v0.9 - Page 26
#
organization_uri = ensure_unparsed(organization_uri)
if organization = mock_data.organization_from_href(organization_uri)
xml = Builder::XmlMarkup.new
mock_it 200,
xml.Org(xmlns.merge(:href => organization.href, :name => organization.name)) {
organization.vdcs.each do |vdc|
xml.Link(:rel => "down",
:href => vdc.href,
:type => "application/vnd.vmware.vcloud.vdc+xml",
:name => vdc.name)
xml.Link(:rel => "down",
:href => vdc.catalog.href,
:type => "application/vnd.vmware.vcloud.catalog+xml",
:name => vdc.catalog.name)
xml.Link(:rel => "down",
:href => vdc.task_list.href,
:type => "application/vnd.vmware.vcloud.tasksList+xml",
:name => vdc.task_list.name)
end
},
{'Content-Type' => "application/vnd.vmware.vcloud.org+xml" }
else
mock_error 200, "401 Unauthorized"
end
end
end
end
end
end
end

View File

@ -4,7 +4,7 @@ module Fog
class Ecloud
class Real
# Handled by the main Vcloud get_vdc
basic_request :get_vdc
end
class Mock

View File

@ -0,0 +1,39 @@
module Fog
class Vcloud
module Terremark
class Ecloud
class Real
unauthenticated_basic_request :get_versions
end
class Mock
def get_versions(versions_uri)
#
# Based off of:
# http://support.theenterprisecloud.com/kb/default.asp?id=535&Lang=1&SID=
# https://community.vcloudexpress.terremark.com/en-us/product_docs/w/wiki/02-get-versions.aspx
# vCloud API Guide v0.9 - Page 89
#
xml = Builder::XmlMarkup.new
mock_it 200,
xml.SupportedVersions( xmlns.merge("xmlns" => "http://www.vmware.com/vcloud/versions")) {
mock_data.versions.select {|version| version.supported }.each do |version|
xml.VersionInfo {
xml.Version(version.version)
xml.LoginUrl(version.login_url)
}
end
}
end
end
end
end
end
end

View File

@ -0,0 +1,51 @@
module Fog
class Vcloud
module Terremark
class Ecloud
class Real
def login
unauthenticated_request({
:expects => 200,
:headers => {
'Authorization' => authorization_header
},
:method => 'POST',
:parse => true,
:uri => login_uri
})
end
end
class Mock
def login
#
# Based off of:
# http://support.theenterprisecloud.com/kb/default.asp?id=536&Lang=1&SID=
# https://community.vcloudexpress.terremark.com/en-us/product_docs/w/wiki/01-get-login-token.aspx
# vCloud API Guide v0.9 - Page 17
#
xml = Builder::XmlMarkup.new
mock_it 200,
xml.OrgList(xmlns) {
mock_data.organizations.each do |organization|
xml.Org( :type => "application/vnd.vmware.vcloud.org+xml", :href => organization.href, :name => organization.name )
end
},
{ 'Set-Cookie' => 'vcloud-token=fc020a05-21d7-4f33-9b2a-25d8cd05a44e; path=/',
'Content-Type' => 'application/vnd.vmware.vcloud.orgslist+xml' }
end
end
end
end
end
end

View File

@ -1,39 +0,0 @@
module Fog
class Vcloud
module Terremark
class Vcloud < Fog::Vcloud
request_path 'fog/vcloud/terremark/vcloud/requests'
request :get_vdc
class Real < Fog::Vcloud::Real
def initialize(options = {})
location = caller.first
warning = "[yellow][WARN] Fog::Vcloud::Terremark::Vcloud is deprecated, to be replaced with Vcloud 1.0 someday/maybe[/]"
warning << " [light_black](" << location << ")[/] "
Formatador.display_line(warning)
super
end
def supporting_versions
["0.8", "0.8a-ext1.6"]
end
end
class Mock < Fog::Vcloud::Mock
def initialize(options = {})
location = caller.first
warning = "[yellow][WARN] Fog::Vcloud::Terremark::Vcloud is deprecated, to be replaced with Vcloud 1.0 someday/maybe[/]"
warning << " [light_black](" << location << ")[/] "
Formatador.display_line(warning)
super
end
end
end
end
end
end

View File

@ -1,57 +0,0 @@
module Fog
class Vcloud
module Terremark
class Vcloud
class Real
# Handled by the main Vcloud get_vdc
end
class Mock
#
#Based off of:
#https://community.vcloudexpress.terremark.com/en-us/product_docs/w/wiki/09-get-vdc.aspx
def get_vdc(vdc_uri)
vdc_uri = ensure_unparsed(vdc_uri)
if vdc = mock_data[:organizations].map { |org| org[:vdcs] }.flatten.detect { |vdc| vdc[:href] == vdc_uri }
xml = Builder::XmlMarkup.new
mock_it 200,
xml.Vdc(xmlns.merge(:href => vdc[:href], :name => vdc[:name])) {
xml.Link(:rel => "down",
:href => vdc[:href] + "/catalog",
:type => "application/vnd.vmware.vcloud.catalog+xml",
:name => vdc[:name])
xml.Link(:rel => "down",
:href => vdc[:href] + "/publicIps",
:type => "application/xml",
:name => "Public IPs")
xml.Link(:rel => "down",
:href => vdc[:href] + "/internetServices",
:type => "application/xml",
:name => "Internet Services")
xml.ResourceEntities {
vdc[:vms].each do |vm|
xml.ResourceEntity(:href => vm[:href],
:type => "application/vnd.vmware.vcloud.vApp+xml",
:name => vm[:name])
end
}
xml.AvailableNetworks {
vdc[:networks].each do |network|
xml.Network(:href => network[:href],
:type => "application/vnd.vmware.vcloud.network+xml",
:name => network[:name])
end
}
}, { 'Content-Type' => 'application/vnd.vmware.vcloud.vdc+xml'}
else
mock_error 200, "401 Unauthorized"
end
end
end
end
end
end
end

View File

@ -1,51 +0,0 @@
require 'vcloud/spec_helper'
if Fog.mocking?
describe "Fog::Vcloud::Vdc", :type => :mock_vcloud_model do
describe :class do
subject { Fog::Vcloud::Vdc }
it { should have_identity(:href) }
it { should have_only_these_attributes([:href, :name, :type, :description, :other_links, :compute_capacity, :storage_capacity, :available_networks,
:resource_entities, :enabled, :vm_quota, :nic_quota, :network_quota, :allocation_model]) }
end
context "with no uri" do
subject { Fog::Vcloud::Vdc.new() }
it { should(have_all_attributes_be_nil) }
end
context "as a collection member" do
subject { @vcloud.vdcs[0].reload }
it { should be_an_instance_of(Fog::Vcloud::Vdc) }
its(:href) { should == @mock_vdc.href }
its(:identity) { should == @mock_vdc.href }
its(:name) { should == @mock_vdc.name }
its(:other_links) { should have(7).items }
its(:resource_entities) { should have(3).items }
its(:available_networks) { should have(2).items }
its(:compute_capacity) { should be_an_instance_of(Hash) }
its(:compute_capacity) { should == {:Cpu =>
{:Units => "Mhz", :Allocated => @mock_vdc.cpu_allocated.to_s, :Limit => @mock_vdc.cpu_allocated.to_s},
:Memory =>
{:Units => "MB", :Allocated => @mock_vdc.memory_allocated.to_s, :Limit => @mock_vdc.memory_allocated.to_s}} }
its(:storage_capacity) { should be_an_instance_of(Hash) }
its(:storage_capacity) { should == {:Limit => @mock_vdc.storage_allocated.to_s, :Units=>"MB", :Allocated => @mock_vdc.storage_allocated.to_s} }
its(:vm_quota) { should == "0" }
its(:nic_quota) { should == "0" }
its(:network_quota) { should == "0" }
its(:enabled) { should == "true" }
end
end
end

View File

@ -1 +0,0 @@
require 'spec_helper'

View File

@ -1,44 +0,0 @@
require 'vcloud/spec_helper'
if Fog.mocking?
describe Fog::Vcloud, :type => :mock_vcloud_request do
subject { @vcloud }
it { should respond_to(:get_network) }
describe :get_network, :type => :vcloud_request do
context "with a valid network uri" do
before { @network = @vcloud.get_network(URI.parse(@mock_network.href)) }
subject { @network }
it_should_behave_like "all responses"
it { should have_headers_denoting_a_content_type_of("application/vnd.vmware.vcloud.network+xml") }
describe :body do
subject { @network.body }
it { should have(9).keys }
it_should_behave_like "it has the standard vcloud v0.8 xmlns attributes" # 3 keys
it { should have_key_with_value(:type, "application/vnd.vmware.vcloud.network+xml") }
it { should have_key_with_value(:Features, {:FenceMode => "isolated"}) }
it { should have_key_with_value(:Description, @mock_network.name) }
it { should have_key_with_value(:href, @mock_network.href) }
it { should have_key_with_value(:name, @mock_network.name) }
it { should have_key_with_value(:Configuration, {:Gateway => @mock_network.gateway,
:Netmask => @mock_network.netmask,
:Dns => @mock_network.dns }) }
end
end
context "with a network uri that doesn't exist" do
subject { lambda { @vcloud.get_network(URI.parse('https://www.fakey.com/api/v0.8/network/999')) } }
it_should_behave_like("a request for a resource that doesn't exist")
end
end
end
else
describe Fog::Vcloud, :type => :vcloud_request do
end
end

View File

@ -1,62 +0,0 @@
require 'vcloud/spec_helper'
#
# WARNING: INCOMPLETE
#
if Fog.mocking?
describe Fog::Vcloud, :type => :mock_vcloud_request do
subject { @vcloud }
it { should respond_to(:get_vdc) }
describe :get_vdc, :type => :vcloud_request do
context "with a valid vdc uri" do
before { @vdc = @vcloud.get_vdc(URI.parse(@mock_vdc.href)) }
subject { @vdc }
it_should_behave_like "all responses"
it { should have_headers_denoting_a_content_type_of("application/vnd.vmware.vcloud.vdc+xml") }
describe :body do
subject { @vdc.body }
it { should have(16).items }
it_should_behave_like("it has the standard vcloud v0.8 xmlns attributes") # 3 keys
its(:name) { should == @mock_vdc.name }
its(:href) { should == @mock_vdc.href }
its(:VmQuota) { should == "0" }
its(:Description) { should == @mock_vdc.name + " VDC" }
its(:NicQuota) { should == "0" }
its(:IsEnabled) { should == "true" }
its(:NetworkQuota) { should == "0" }
its(:AllocationModel) { should == "AllocationPool" }
its(:Link) { should have(7).links }
its(:ResourceEntities) { should have(1).resource }
let(:resource_entities) { subject[:ResourceEntities][:ResourceEntity] }
specify { resource_entities.should have(3).vapps }
#FIXME: test for the resources
its(:ComputeCapacity) { should == {:Memory => { :Units => "MB", :Allocated => @mock_vdc.memory_allocated.to_s, :Limit => @mock_vdc.memory_allocated.to_s },
:Cpu => { :Units => "Mhz", :Allocated => @mock_vdc.cpu_allocated.to_s, :Limit => @mock_vdc.cpu_allocated.to_s } } }
its(:StorageCapacity) { should == {:Units => "MB", :Allocated => @mock_vdc.storage_allocated.to_s, :Limit => @mock_vdc.storage_allocated.to_s } }
let(:available_networks) { subject[:AvailableNetworks][:Network] }
specify { available_networks.should have(2).networks }
#FIXME :test the available networks
end
end
context "with a vdc uri that doesn't exist" do
subject { lambda { @vcloud.get_vdc(URI.parse('https://www.fakey.com/api/v0.8/vdc/999')) } }
it_should_behave_like("a request for a resource that doesn't exist")
end
end
end
end

View File

@ -1,24 +0,0 @@
require 'vcloud/spec_helper'
shared_examples_for "real or mock login requests" do
subject { @vcloud }
it_should_behave_like "all login requests"
end
if Fog.mocking?
describe Fog::Vcloud, :type => :mock_vcloud_request do
it_should_behave_like "real or mock login requests"
describe "#body" do
subject { @vcloud.login.body }
its(:Org) { should == { :type => "application/vnd.vmware.vcloud.org+xml",
:href => @mock_organization.href,
:name => @mock_organization.name} }
end
end
else
describe Fog::Vcloud, :type => :vcloud_request do
it_should_behave_like "real or mock login requests"
end
end

View File

@ -1,7 +1,7 @@
require 'vcloud/spec_helper'
if Fog.mocking?
describe Fog::Vcloud, :type => :mock_vcloud_request do
describe Fog::Vcloud, :type => :mock_tmrk_ecloud_request do
subject { @vcloud }
it { should respond_to(:get_organization) }

View File

@ -38,7 +38,7 @@ shared_examples_for "real or mock get_versions requests" do
end
if Fog.mocking?
describe Fog::Vcloud, :type => :mock_vcloud_request do
describe Fog::Vcloud, :type => :mock_tmrk_ecloud_request do
it_should_behave_like "real or mock get_versions requests"
@ -48,7 +48,7 @@ if Fog.mocking?
end
end
else
describe Fog::Vcloud, :type => :vcloud_request do
describe Fog::Vcloud, :type => :mock_tmrk_ecloud_request do
it_should_behave_like "real or mock get_versions requests"
end
end

View File

@ -1,10 +1,10 @@
require 'vcloud/spec_helper'
if Fog.mocking?
describe Fog::Vcloud, :type => :mock_vcloud_request do
subject { Fog::Vcloud.new(:username => "foo", :password => "bar", :versions_uri => "https://fakey.com/api/versions") }
describe Fog::Vcloud, :type => :mock_tmrk_ecloud_request do
subject { @vcloud }
it { should be_an_instance_of(Fog::Vcloud::Mock) }
it { should be_an_instance_of(Fog::Vcloud::Terremark::Ecloud::Mock) }
it { should respond_to(:default_organization_uri) }