Sha256: b1d43a7045b27b64ed43ad23cfa5c0a3eef2659cfdacf90ab527e3a4498c3b98

Contents?: true

Size: 1.37 KB

Versions: 1

Compression:

Stored size: 1.37 KB

Contents

require 'minitest/autorun'

require_relative File.join('..', '..', '..', 'lib', 'deltacloud', 'api.rb')

describe 'MockDriver StorageSnapshots' do

  before do
    @driver = Deltacloud::new(:mock, :user => 'mockuser', :password => 'mockpassword')
  end

  it 'must throw error when wrong credentials' do
    Proc.new do
      @driver.backend.storage_snapshots(OpenStruct.new(:user => 'unknown', :password => 'wrong'))
    end.must_raise Deltacloud::ExceptionHandler::AuthenticationFailure, 'Authentication Failure'
  end

  it 'must return list of storage_snapshots' do
    @driver.storage_snapshots.wont_be_empty
    @driver.storage_snapshots.first.must_be_kind_of StorageSnapshot
  end

  it 'must allow to filter storage_snapshots' do
    @driver.storage_snapshots(:id => 'snap1').wont_be_empty
    @driver.storage_snapshots(:id => 'snap1').must_be_kind_of Array
    @driver.storage_snapshots(:id => 'snap1').size.must_equal 1
    @driver.storage_snapshots(:id => 'snap1').first.id.must_equal 'snap1'
    @driver.storage_snapshots(:id => 'unknown').must_be_empty
  end

  it 'must allow to retrieve single storage_snapshot' do
    @driver.storage_snapshot(:id => 'snap1').wont_be_nil
    @driver.storage_snapshot(:id => 'snap1').must_be_kind_of StorageSnapshot
    @driver.storage_snapshot(:id => 'snap1').id.must_equal 'snap1'
    @driver.storage_snapshot(:id => 'unknown').must_be_nil
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
deltacloud-core-1.0.2 tests/drivers/mock/storage_snapshots_test.rb