1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/tests/openstack/requests/network/network_tests.rb
Ferran Rodenas 0c34ca84f5 [openstack|network] Add support for OpenStack Quantum
Added support for OpenStack Network Connectivity (Quantum).
2012-09-22 00:14:40 +02:00

56 lines
No EOL
1.9 KiB
Ruby

Shindo.tests('Fog::Network[:openstack] | network requests', ['openstack']) do
@network_format = {
'id' => String,
'name' => String,
'subnets' => Array,
'shared' => Fog::Boolean,
'status' => String,
'admin_state_up' => Fog::Boolean,
'tenant_id' => String,
}
tests('success') do
tests('#create_network').formats({'network' => @network_format}) do
attributes = {:name => 'net_name', :shared => false,
:admin_state_up => true, :tenant_id => 'tenant_id'}
Fog::Network[:openstack].create_network(attributes).body
end
tests('#list_networks').formats({'networks' => [@network_format]}) do
Fog::Network[:openstack].list_networks.body
end
tests('#get_network').formats({'network' => @network_format}) do
network_id = Fog::Network[:openstack].networks.all.first.id
Fog::Network[:openstack].get_network(network_id).body
end
tests('#update_network').formats({'network' => @network_format}) do
network_id = Fog::Network[:openstack].networks.all.first.id
attributes = {:name => 'net_name', :shared => false,
:admin_state_up => true}
Fog::Network[:openstack].update_network(network_id, attributes).body
end
tests('#delete_network').succeeds do
network_id = Fog::Network[:openstack].networks.all.first.id
Fog::Network[:openstack].delete_network(network_id)
end
end
tests('failure') do
tests('#get_network').raises(Fog::Network::OpenStack::NotFound) do
Fog::Network[:openstack].get_network(0)
end
tests('#update_network').raises(Fog::Network::OpenStack::NotFound) do
Fog::Network[:openstack].update_network(0, {})
end
tests('#delete_network').raises(Fog::Network::OpenStack::NotFound) do
Fog::Network[:openstack].delete_network(0)
end
end
end