Sha256: 4d33a2c726a7dc949f4576eebd94b5a5f6bbedeb098c9ff22f1852f4fc172bf8

Contents?: true

Size: 1.36 KB

Versions: 3

Compression:

Stored size: 1.36 KB

Contents

require 'rubygems'
require 'require_relative' if RUBY_VERSION < '1.9'

require_relative 'common'

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::Exceptions::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

3 entries across 3 versions & 1 rubygems

Version Path
deltacloud-core-1.1.1 tests/drivers/mock/storage_snapshots_test.rb
deltacloud-core-1.1.0 tests/drivers/mock/storage_snapshots_test.rb
deltacloud-core-1.0.5 tests/drivers/mock/storage_snapshots_test.rb