Sha256: 5d6e1d47a6208c186b32aa1794a5d1e7455d70e6c14d59aadbff09e34db4e4e8

Contents?: true

Size: 1.06 KB

Versions: 15

Compression:

Stored size: 1.06 KB

Contents

class TestVolume < TestYaoResource
  def test_volume
    params = {
        'name' => 'cinder',
        'size' => 10
    }

    volume = Yao::Volume.new(params)
    assert_equal(volume.name, 'cinder')
    assert_equal(volume.size, 10)
  end

  def test_list
    # https://docs.openstack.org/api-ref/block-storage/v3/index.html?expanded=#volumes-volumes
    stub = stub_request(:get, "https://example.com:12345/volumes/detail").
      to_return(
        status: 200,
        body: <<-JSON,
        {
            "volumes": [
                {
                    "id": "00000000-0000-0000-0000-000000000000"
                }
            ]
        }
        JSON
        headers: {'Content-Type' => 'application/json'}
      )

    assert(Yao::Volume.resources_detail_available)

    volumes = Yao::Volume.list
    assert_instance_of(Yao::Volume, volumes.first)
    assert_equal("00000000-0000-0000-0000-000000000000", volumes.first.id)

    assert_requested(stub)
  end

  def test_list_detail
    assert_equal(Yao::Volume.method(:list), Yao::Volume.method(:list_detail))
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
yao-0.14.0 test/yao/resources/test_volume.rb
yao-0.13.4 test/yao/resources/test_volume.rb
yao-0.13.3 test/yao/resources/test_volume.rb
yao-0.13.2 test/yao/resources/test_volume.rb
yao-0.13.1 test/yao/resources/test_volume.rb
yao-0.13.0 test/yao/resources/test_volume.rb
yao-0.12.0 test/yao/resources/test_volume.rb
yao-0.11.3 test/yao/resources/test_volume.rb
yao-0.11.2 test/yao/resources/test_volume.rb
yao-0.11.1 test/yao/resources/test_volume.rb
yao-0.11.0 test/yao/resources/test_volume.rb
yao-0.10.1 test/yao/resources/test_volume.rb
yao-0.10.0 test/yao/resources/test_volume.rb
yao-0.9.1 test/yao/resources/test_volume.rb
yao-0.9.0 test/yao/resources/test_volume.rb