File: volume_tests.rb

package info (click to toggle)
ruby-fog-openstack 1.1.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 11,784 kB
  • sloc: ruby: 47,937; makefile: 5; sh: 4
file content (47 lines) | stat: -rw-r--r-- 1,307 bytes parent folder | download
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