dxsdk-27 add the test back in

This commit is contained in:
howete 2013-03-27 08:53:16 -06:00 committed by Rupak Ganguly
parent fddda2e729
commit 0016dfdea8
4 changed files with 87 additions and 0 deletions

View File

@ -0,0 +1,29 @@
require 'date'
Shindo.tests('Fog::HP::BlockStorage', ['hp']) do
credentials = {
:auth_token => 'auth_token',
:endpoint_url => 'http://127.0.0.1:0/path/',
:expires => (DateTime.now + 1).to_s
}
options = {
:hp_access_key => 'hp_account_id',
:hp_secret_key => 'hp_secret_key',
:hp_tenant_id => 'hp_tenant_id',
:hp_avl_zone => 'hp_avl_zone',
:hp_auth_uri => 'hp_auth_uri',
: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::SocketError) { Fog::HP::BlockStorage::Real.new(options) }
end
tests('Test no expires') do
credentials[:expires] = nil
raises(Excon::Errors::SocketError) { Fog::HP::BlockStorage::Real.new(options) }
end
end

19
tests/hp/cdn_tests.rb Normal file
View File

@ -0,0 +1,19 @@
Shindo.tests('Fog::CDN::HP', ['hp']) do
credentials = {
:auth_token => 'auth_token',
:endpoint_url => 'http://127.0.0.1/cdnpath/',
:expires => (DateTime.now + 1).to_s
}
options = {
:hp_access_key => 'hp_account_id',
:hp_secret_key => 'hp_secret_key',
:hp_tenant_id => 'hp_tenant_id',
:hp_avl_zone => 'hp_avl_zone',
:hp_auth_uri => 'hp_auth_uri',
:credentials => credentials
}
tests('Test cached CDN credentials').returns(credentials) do
conn = Fog::CDN::HP::Real.new(options)
conn.credentials
end
end

19
tests/hp/compute_tests.rb Normal file
View File

@ -0,0 +1,19 @@
Shindo.tests('Fog::Compute::HP', ['hp']) do
credentials = {
:auth_token => 'auth_token',
:endpoint_url => 'http://127.0.0.1/computepath/',
:expires => (DateTime.now + 1).to_s
}
options = {
:hp_access_key => 'hp_account_id',
:hp_secret_key => 'hp_secret_key',
:hp_tenant_id => 'hp_tenant_id',
:hp_avl_zone => 'hp_avl_zone',
:hp_auth_uri => 'hp_auth_uri',
:credentials => credentials
}
tests('Test cached Compute credentials').returns(credentials) do
conn = Fog::Compute::HP::Real.new(options)
conn.credentials
end
end

20
tests/hp/storage_tests.rb Normal file
View File

@ -0,0 +1,20 @@
Shindo.tests('Fog::Storage::HP', ['hp']) do
credentials = {
:auth_token => 'auth_token',
:endpoint_url => 'http://127.0.0.1/path/',
:cdn_endpoint_url => 'hp_cdn_uri',
:expires => (DateTime.now + 1).to_s
}
options = {
:hp_access_key => 'hp_account_id',
:hp_secret_key => 'hp_secret_key',
:hp_tenant_id => 'hp_tenant_id',
:hp_avl_zone => 'hp_avl_zone',
:hp_auth_uri => 'hp_auth_uri',
:credentials => credentials
}
tests('Test cached Storage credentials').returns(credentials) do
conn = Fog::Storage::HP::Real.new(options)
conn.credentials
end
end