mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
seperate mock related helpers
This commit is contained in:
parent
09c593b57a
commit
a13fd68e39
2 changed files with 36 additions and 35 deletions
|
@ -2,38 +2,10 @@ $LOAD_PATH.unshift File.expand_path(File.join(File.dirname(__FILE__), %w[ .. lib
|
||||||
require 'fog'
|
require 'fog'
|
||||||
require 'fog/bin'
|
require 'fog/bin'
|
||||||
|
|
||||||
# Use so you can run in mock mode from the command line
|
require File.join(File.dirname(__FILE__), 'helpers', 'mock_helper')
|
||||||
#
|
|
||||||
# FOG_MOCK=true fog
|
|
||||||
|
|
||||||
if ENV["FOG_MOCK"] == "true"
|
def lorem_file
|
||||||
Fog.mock!
|
File.open(File.dirname(__FILE__) + '/lorem.txt', 'r')
|
||||||
end
|
|
||||||
|
|
||||||
# if in mocked mode, fill in some fake credentials for us
|
|
||||||
if Fog.mock?
|
|
||||||
Fog.instance_variable_set(:@credentials, {
|
|
||||||
:aws_access_key_id => 'aws_access_key_id',
|
|
||||||
:aws_secret_access_key => 'aws_secret_access_key',
|
|
||||||
:bluebox_api_key => 'bluebox_api_key',
|
|
||||||
:bluebox_customer_id => 'bluebox_customer_id',
|
|
||||||
:brightbox_client_id => 'brightbox_client_id',
|
|
||||||
:brightbox_secret => 'brightbox_secret',
|
|
||||||
:go_grid_api_key => 'go_grid_api_key',
|
|
||||||
:go_grid_shared_secret => 'go_grid_shared_secret',
|
|
||||||
:google_storage_access_key_id => 'google_storage_access_key_id',
|
|
||||||
:google_storage_secret_access_key => 'google_storage_secret_access_key',
|
|
||||||
:linode_api_key => 'linode_api_key',
|
|
||||||
:new_servers_password => 'new_servers_password',
|
|
||||||
:new_servers_username => 'new_servers_username',
|
|
||||||
# :public_key_path => '~/.ssh/id_rsa.pub',
|
|
||||||
# :private_key_path => '~/.ssh/id_rsa',
|
|
||||||
:rackspace_api_key => 'rackspace_api_key',
|
|
||||||
:rackspace_username => 'rackspace_username',
|
|
||||||
:slicehost_password => 'slicehost_password',
|
|
||||||
:zerigo_email => 'zerigo_email',
|
|
||||||
:zerigo_token => 'zerigo_token'
|
|
||||||
})
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# check to see which credentials are available and add others to the skipped tags list
|
# check to see which credentials are available and add others to the skipped tags list
|
||||||
|
@ -43,7 +15,3 @@ for provider in (all_providers - available_providers)
|
||||||
Formatador.display_line("[yellow]Skipping tests for [bold]#{provider}[/] [yellow]due to lacking credentials (add some to '~/.fog' to run them)[/]")
|
Formatador.display_line("[yellow]Skipping tests for [bold]#{provider}[/] [yellow]due to lacking credentials (add some to '~/.fog' to run them)[/]")
|
||||||
Thread.current[:tags] << ('-' << provider)
|
Thread.current[:tags] << ('-' << provider)
|
||||||
end
|
end
|
||||||
|
|
||||||
def lorem_file
|
|
||||||
File.open(File.dirname(__FILE__) + '/lorem.txt', 'r')
|
|
||||||
end
|
|
||||||
|
|
33
tests/helpers/mock_helper.rb
Normal file
33
tests/helpers/mock_helper.rb
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
# Use so you can run in mock mode from the command line
|
||||||
|
#
|
||||||
|
# FOG_MOCK=true fog
|
||||||
|
|
||||||
|
if ENV["FOG_MOCK"] == "true"
|
||||||
|
Fog.mock!
|
||||||
|
end
|
||||||
|
|
||||||
|
# if in mocked mode, fill in some fake credentials for us
|
||||||
|
if Fog.mock?
|
||||||
|
Fog.instance_variable_set(:@credentials, {
|
||||||
|
:aws_access_key_id => 'aws_access_key_id',
|
||||||
|
:aws_secret_access_key => 'aws_secret_access_key',
|
||||||
|
:bluebox_api_key => 'bluebox_api_key',
|
||||||
|
:bluebox_customer_id => 'bluebox_customer_id',
|
||||||
|
:brightbox_client_id => 'brightbox_client_id',
|
||||||
|
:brightbox_secret => 'brightbox_secret',
|
||||||
|
:go_grid_api_key => 'go_grid_api_key',
|
||||||
|
:go_grid_shared_secret => 'go_grid_shared_secret',
|
||||||
|
:google_storage_access_key_id => 'google_storage_access_key_id',
|
||||||
|
:google_storage_secret_access_key => 'google_storage_secret_access_key',
|
||||||
|
:linode_api_key => 'linode_api_key',
|
||||||
|
:new_servers_password => 'new_servers_password',
|
||||||
|
:new_servers_username => 'new_servers_username',
|
||||||
|
# :public_key_path => '~/.ssh/id_rsa.pub',
|
||||||
|
# :private_key_path => '~/.ssh/id_rsa',
|
||||||
|
:rackspace_api_key => 'rackspace_api_key',
|
||||||
|
:rackspace_username => 'rackspace_username',
|
||||||
|
:slicehost_password => 'slicehost_password',
|
||||||
|
:zerigo_email => 'zerigo_email',
|
||||||
|
:zerigo_token => 'zerigo_token'
|
||||||
|
})
|
||||||
|
end
|
Loading…
Add table
Reference in a new issue