Sha256: b5023f0b3f6b9fa7e304a23b4d7392fcbf10900981126199188e85938aab47b5

Contents?: true

Size: 1.61 KB

Versions: 67

Compression:

Stored size: 1.61 KB

Contents

require 'date'

Shindo.tests('Fog::HP::BlockStorage', ['hp', 'blockstorage']) do
  credentials = {
    :auth_token => 'auth_token',
    :endpoint_url => 'http://127.0.0.1/bpath/',
    :service_catalog => {
      :"Block Storage" => {
      :zone => 'http://127.0.0.1/bpath/'}},
    :expires => (DateTime.now + 1).to_s
  }
  options = {
    :hp_access_key => 'key',
    :hp_secret_key => 'secret',
    :hp_tenant_id => 'tenant',
    :hp_avl_zone => 'zone',
    :hp_auth_uri => 'https://region-a.geo-1.identity.hpcloudsvc.com:35357/v2.0/tokens',
    :credentials => credentials
  }
  tests('Test good credentials').returns(credentials) do
    conn = Fog::HP::BlockStorage::Real.new(options)
    conn.credentials
  end
  tests('Test expired credentials') do
    credentials[:expires] = (DateTime.now - 1).to_s
    raises(Excon::Errors::Unauthorized) { Fog::HP::BlockStorage::Real.new(options) }
  end
  tests('Test no expires') do
    credentials[:expires] = nil
    raises(Excon::Errors::Unauthorized) { Fog::HP::BlockStorage::Real.new(options) }
  end
  tests('Test no creds') do
    options[:credentials] = nil
    raises(Excon::Errors::Unauthorized) { Fog::HP::BlockStorage::Real.new(options) }
  end
  tests('Test no service') do
    options[:credentials] = credentials
    options[:credentials][:service_catalog] = {
      :"CDN" => {
      :zone => 'http://127.0.0.1/bpath/'}},
    raises(Excon::Errors::Unauthorized) { Fog::HP::BlockStorage::Real.new(options) }
  end
  tests('Test no creds') do
    options[:credentials][:service_catalog] = nil
    raises(Excon::Errors::Unauthorized) { Fog::HP::BlockStorage::Real.new(options) }
  end
end

Version data entries

67 entries across 67 versions & 5 rubygems

Version Path
fog-1.38.0 tests/hp/block_storage_tests.rb
fog-1.37.0 tests/hp/block_storage_tests.rb
fog-1.36.0 tests/hp/block_storage_tests.rb
fog-1.35.0 tests/hp/block_storage_tests.rb
fog-2.0.0.pre.0 tests/hp/block_storage_tests.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-1.32.0/tests/hp/block_storage_tests.rb
fog-1.34.0 tests/hp/block_storage_tests.rb
fog-1.33.0 tests/hp/block_storage_tests.rb
fog-1.32.0 tests/hp/block_storage_tests.rb
fog-1.31.0 tests/hp/block_storage_tests.rb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/fog-1.22.1/tests/hp/block_storage_tests.rb
fog-1.30.0 tests/hp/block_storage_tests.rb
fog-1.29.0 tests/hp/block_storage_tests.rb
fog-1.28.0 tests/hp/block_storage_tests.rb
fog-1.27.0 tests/hp/block_storage_tests.rb
fog-1.26.0 tests/hp/block_storage_tests.rb
fog-1.25.0 tests/hp/block_storage_tests.rb
nsidc-fog-1.24.1 tests/hp/block_storage_tests.rb
fog-1.24.0 tests/hp/block_storage_tests.rb
ns-fog-1.22.11 tests/hp/block_storage_tests.rb