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
Paul Thornthwaite 716f3f13be [ecloud|compute] Fixes tagging of some tests
Internet Service and Server tests were not tagged "ecloud" so were being
ran along live tests and failing if credentials were not in place.

Adding the tags skips the tests if credentials are missing.
2013-01-08 17:50:21 +00:00

28 lines
1.2 KiB
Ruby

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
@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