diff --git a/tests/hp/requests/network/network_tests.rb b/tests/hp/requests/network/network_tests.rb new file mode 100644 index 000000000..d76b9d4b7 --- /dev/null +++ b/tests/hp/requests/network/network_tests.rb @@ -0,0 +1,57 @@ +Shindo.tests("HP::Network | network requests", ['hp', 'network']) do + + @network_format = { + 'id' => String, + 'name' => String, + 'tenant_id' => String, + 'status' => String, + 'subnets' => Array, + 'router:external' => Fog::Boolean, + 'admin_state_up' => Fog::Boolean, + 'shared' => Fog::Boolean + } + + tests('success') do + + @network_id = nil + + tests('#create_network').formats(@network_format) do + attributes = {:name => 'my_network', :admin_state_up => true, :shared => false, :tenant_id => '111111111'} + data = HP[:network].create_network(attributes).body['network'] + @network_id = data['id'] + data + end + + tests('#list_networks').formats({'networks' => [@network_format]}) do + HP[:network].list_networks.body + end + + tests("#get_network(#{@network_id})").formats({'network' => @network_format}) do + HP[:network].get_network(@network_id).body + end + + tests("#update_network(#{@network_id})").formats({'network' => @network_format}) do + attributes = {:name => 'my_network_upd', :shared => false, :admin_state_up => true} + HP[:network].update_network(@network_id, attributes).body + end + + tests("#delete_network(#{@network_id})").succeeds do + HP[:network].delete_network(@network_id) + end + end + + tests('failure') do + tests('#get_network(0)').raises(Fog::HP::Network::NotFound) do + HP[:network].get_network(0) + end + + tests('#update_network(0)').raises(Fog::HP::Network::NotFound) do + HP[:network].update_network(0, {}) + end + + tests('#delete_network(0)').raises(Fog::HP::Network::NotFound) do + HP[:network].delete_network(0) + end + end + +end \ No newline at end of file