2011-06-16 19:28:54 -04:00
|
|
|
Shindo.tests('Fog::Compute[:brightbox] | interface requests', ['brightbox']) do
|
2010-12-06 09:50:59 -05:00
|
|
|
|
2012-11-26 06:28:43 -05:00
|
|
|
@test_service = Fog::Compute[:brightbox]
|
|
|
|
|
2010-12-06 09:50:59 -05:00
|
|
|
tests('success') do
|
|
|
|
|
2010-12-17 19:49:22 -05:00
|
|
|
unless Fog.mocking?
|
2012-11-26 06:28:43 -05:00
|
|
|
server = @test_service.servers.first
|
|
|
|
|
|
|
|
# If no server is available, create one just for the test
|
|
|
|
unless server
|
|
|
|
@test_server = Brightbox::Compute::TestSupport.get_test_server
|
|
|
|
server = @test_server
|
|
|
|
end
|
|
|
|
|
2010-12-17 19:49:22 -05:00
|
|
|
@interface_id = server.interfaces.first["id"]
|
|
|
|
end
|
|
|
|
|
2011-09-29 05:15:03 -04:00
|
|
|
tests("#get_interface('#{@interface_id}')") do
|
2010-12-17 19:49:22 -05:00
|
|
|
pending if Fog.mocking?
|
2012-11-26 06:28:43 -05:00
|
|
|
result = @test_service.get_interface(@interface_id)
|
2012-02-06 05:49:18 -05:00
|
|
|
formats(Brightbox::Compute::Formats::Full::INTERFACE, false) { result }
|
2010-12-06 09:50:59 -05:00
|
|
|
end
|
|
|
|
|
2012-11-26 06:28:43 -05:00
|
|
|
unless Fog.mocking?
|
|
|
|
# If we created a server just for this test, clean it up
|
|
|
|
@test_server.destroy if @test_server
|
|
|
|
end
|
|
|
|
|
2010-12-06 09:50:59 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
tests('failure') do
|
|
|
|
|
2011-08-18 04:54:28 -04:00
|
|
|
tests("#get_interface('int-00000')").raises(Excon::Errors::NotFound) do
|
2010-12-17 19:49:22 -05:00
|
|
|
pending if Fog.mocking?
|
2012-11-26 06:28:43 -05:00
|
|
|
@test_service.get_interface('int-00000')
|
2010-12-06 09:50:59 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
tests("#get_interface()").raises(ArgumentError) do
|
2010-12-17 19:49:22 -05:00
|
|
|
pending if Fog.mocking?
|
2012-11-26 06:28:43 -05:00
|
|
|
@test_service.get_interface()
|
2010-12-06 09:50:59 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|