From 587dcbe609aa196f091c9aa78aca5eef5c629cdb Mon Sep 17 00:00:00 2001 From: "Brian D. Burns" Date: Tue, 13 Aug 2013 04:57:36 +0000 Subject: [PATCH] [openstack|compute] update volume tests --- .../requests/compute/create_volume.rb | 15 +++++++------ .../requests/compute/volume_tests.rb | 22 +++++++++---------- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/lib/fog/openstack/requests/compute/create_volume.rb b/lib/fog/openstack/requests/compute/create_volume.rb index 829e2d7c3..c18003fd2 100644 --- a/lib/fog/openstack/requests/compute/create_volume.rb +++ b/lib/fog/openstack/requests/compute/create_volume.rb @@ -33,15 +33,16 @@ module Fog response.status = 202 data = { 'id' => Fog::Mock.random_numbers(2), - 'name' => name, - 'description' => description, + 'displayName' => name, + 'displayDescription' => description, 'size' => size, 'status' => 'creating', - 'snapshot_id' => '4', - 'volume_type' => nil, - 'availability_zone' => 'nova', - 'created_at' => Time.now, - 'attachments' => [] + 'snapshotId' => nil, + 'volumeType' => 'None', + 'availabilityZone' => 'nova', + 'createdAt' => Time.now.strftime('%FT%T.%6N'), + 'attachments' => [], + 'metadata' => {} } self.data[:volumes][data['id']] = data response.body = { 'volume' => data } diff --git a/tests/openstack/requests/compute/volume_tests.rb b/tests/openstack/requests/compute/volume_tests.rb index e08755e23..60b3322e3 100644 --- a/tests/openstack/requests/compute/volume_tests.rb +++ b/tests/openstack/requests/compute/volume_tests.rb @@ -4,35 +4,33 @@ Shindo.tests('Fog::Compute[:openstack] | volume requests', ['openstack']) do @volume_format = { 'id' => String, - 'name' => String, + 'displayName' => String, 'size' => Integer, - 'description' => String, + 'displayDescription' => String, 'status' => String, - 'snapshot_id' => Fog::Nullable::String, - 'availability_zone' => String, + 'snapshotId' => Fog::Nullable::String, + 'availabilityZone' => String, 'attachments' => Array, - 'volume_type' => Fog::Nullable::String, - 'created_at' => Time + 'volumeType' => Fog::Nullable::String, + 'createdAt' => String, + 'metadata' => Hash } tests('success') do - tests('#create_volume').formats({'volume' => @volume_format}) do - pending unless Fog.mocking? + tests('#create_volume').data_matches_schema({'volume' => @volume_format}) do Fog::Compute[:openstack].create_volume('loud', 'this is a loud volume', 3).body end - tests('#list_volumes').formats({'volumes' => [@volume_format]}) do + tests('#list_volumes').data_matches_schema({'volumes' => [@volume_format]}) do Fog::Compute[:openstack].list_volumes.body end - tests('#get_volume_detail').formats({'volume' => @volume_format}) do - pending unless Fog.mocking? + tests('#get_volume_detail').data_matches_schema({'volume' => @volume_format}) do volume_id = Fog::Compute[:openstack].volumes.all.first.id Fog::Compute[:openstack].get_volume_details(volume_id).body end tests('#delete_volume').succeeds do - pending unless Fog.mocking? volume_id = Fog::Compute[:openstack].volumes.all.first.id Fog::Compute[:openstack].delete_volume(volume_id) end