1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/tests/joyent/requests/compute/networks_tests.rb
Blake Irvin and Eric Saxby 5fc41c8dc2 Add joyent API version and network support GH-1853
Adding support for listing networks in the Joyent Cloud.
:joyent_version was defined in a way that it would always
fall back to the default '~6.5'. Creating servers with
a particular network requires setting :joyent_version to '~7.0'
or greater.
2013-06-02 17:28:05 +08:00

39 lines
1,016 B
Ruby

Shindo.tests("Fog::Compute[:joyent] | network requests", ["joyent"]) do
@provider = Fog::Compute[:joyent]
@network_format = {
"id" => String,
"name" => String,
"public" => Fog::Boolean
}
if Fog.mock?
@networks = Fog::Compute[:joyent].data[:networks] = {
"193d6804-256c-4e89-a4cd-46f045959993" => {
"id" => "193d6804-256c-4e89-a4cd-46f045959993",
"name" => "Joyent-SDC-Private",
"public" => false
},
"1e7bb0e1-25a9-43b6-bb19-f79ae9540b39" => {
"id" => "1e7bb0e1-25a9-43b6-bb19-f79ae9540b39",
"name" => "Joyent-SDC-Public",
"public" => true
}
}
end
tests("#list_networks") do
if Fog.mock?
returns(@networks.length, "correct number of networks") do
@provider.list_networks.body.length
end
end
returns(Array, "returns an Array of networks") do
@provider.list_networks.body.class
end
formats([@network_format]) do
@provider.list_networks.body
end
end
end