2010-11-12 02:01:18 -05:00
|
|
|
def flavors_tests(connection, params = {}, mocks_implemented = true)
|
|
|
|
tests('success') do
|
|
|
|
|
|
|
|
tests("#all").succeeds do
|
|
|
|
pending if Fog.mocking? && !mocks_implemented
|
|
|
|
connection.flavors.all
|
|
|
|
end
|
|
|
|
|
2010-11-16 14:47:05 -05:00
|
|
|
if !Fog.mocking? || mocks_implemented
|
|
|
|
@identity = connection.flavors.first.identity
|
|
|
|
end
|
2010-11-12 02:01:18 -05:00
|
|
|
|
|
|
|
tests("#get('#{@identity}')").succeeds do
|
|
|
|
pending if Fog.mocking? && !mocks_implemented
|
|
|
|
connection.flavors.get(@identity)
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
tests('failure') do
|
|
|
|
|
2010-11-16 14:47:05 -05:00
|
|
|
if !Fog.mocking? || mocks_implemented
|
2010-11-16 18:31:34 -05:00
|
|
|
invalid_flavor_identity = connection.flavors.first.identity.to_s.gsub(/\w/, '0')
|
2010-11-16 14:47:05 -05:00
|
|
|
end
|
2010-11-12 02:01:18 -05:00
|
|
|
|
|
|
|
tests("#get('#{invalid_flavor_identity}')").returns(nil) do
|
|
|
|
pending if Fog.mocking? && !mocks_implemented
|
|
|
|
connection.flavors.get(invalid_flavor_identity)
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|