1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/tests/ecloud/compute/models/internet_service_tests.rb

29 lines
1.2 KiB
Ruby
Raw Normal View History

2012-11-27 19:57:16 -05:00
provider, config = :ecloud, compute_providers[:ecloud]
Shindo.tests("Fog::Compute[:#{provider}] | internet_services", [provider.to_s, "queries"]) do
connection = Fog::Compute[provider]
organization = connection.organizations.first
environment = organization.environments.detect { |e| e.name == config[:ecloud_environment_name] } || organization.environments.first
public_ips = environment.public_ips
public_ip = public_ips.detect { |i| i.name == config[:ecloud_public_ip_name] } || public_ips.first
2012-11-27 19:57:16 -05:00
@internet_services = public_ip.internet_services
tests('#all').succeeds do
returns(true, "is a collection") { @internet_services.is_a?(Fog::Compute::Ecloud::InternetServices) }
if Fog.mocking?
returns(false, "has services") { @internet_services.empty? }
else
true
end
end
unless @internet_services.empty?
tests('#get').succeeds do
service = @internet_services.first
fetched_service = connection.internet_services.get(service.href)
returns(false, "service is not nil") { fetched_service.nil? }
returns(true, "is an InternetService") { fetched_service.is_a?(Fog::Compute::Ecloud::InternetService) }
end
end
end