1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
require "test_helper"
describe "Fog::OpenStack::Compute | volume requests" do
before do
@volume_format = {
'id' => String,
'displayName' => String,
'size' => Integer,
'displayDescription' => String,
'status' => String,
'snapshotId' => Fog::Nullable::String,
'availabilityZone' => String,
'attachments' => Array,
'volumeType' => Fog::Nullable::String,
'createdAt' => String,
'metadata' => Hash
}
@compute = Fog::OpenStack::Compute.new
@volume = @compute.create_volume('loud', 'this is a loud volume', 3).body
end
describe "success" do
it "#create_volume" do
@volume.must_match_schema('volume' => @volume_format)
end
it "#list_volumes" do
@compute.list_volumes.body.must_match_schema('volumes' => [@volume_format])
end
describe "body" do
before do
@volume_id = @compute.volumes.all.first.id
end
it "#get_volume_detail" do
@compute.get_volume_details(@volume_id).
body.must_match_schema('volume' => @volume_format)
end
it "delete_volume" do
@compute.delete_volume(@volume_id).status.must_equal 204
end
end
end
end
|