1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

Remove trailing whitespace

Done with `rubocop --auto-correct --only TrailingWhitespace`
This commit is contained in:
Paul Thornthwaite 2014-05-26 14:44:18 +01:00
parent 330a351ade
commit ef9a9697ab
213 changed files with 836 additions and 836 deletions

View file

@ -155,8 +155,8 @@ module Fog
params.delete(:host) #invalid excon request parameter
parse = params.delete(:parse)
parse = params.delete(:parse)
begin
response = @connection.request(params, &block)
rescue Excon::Errors::HTTPStatusError => error

View file

@ -4,7 +4,7 @@ module Fog
module AWS
class ElasticBeanstalk < Fog::Service
extend Fog::AWS::CredentialFetcher::ServiceMethods
class InvalidParameterError < Fog::Errors::Error; end
requires :aws_access_key_id, :aws_secret_access_key

View file

@ -4,7 +4,7 @@ module Fog
module AWS
class Glacier < Fog::Service
extend Fog::AWS::CredentialFetcher::ServiceMethods
requires :aws_access_key_id, :aws_secret_access_key
recognizes :region, :host, :path, :port, :scheme, :persistent, :use_iam_profile, :aws_session_token, :aws_credentials_expire_at

View file

@ -20,7 +20,7 @@ module Fog
attribute :security_groups, :aliases => 'SecurityGroups'
attribute :user_data, :aliases => 'UserData'
attribute :spot_price, :aliases => 'SpotPrice'
def initialize(attributes={})
#attributes[:availability_zones] ||= %w(us-east-1a us-east-1b us-east-1c us-east-1d)

View file

@ -4,7 +4,7 @@ module Fog
module CDN
class AWS
module DistributionsHelper
def all(options = {})
merge_attributes(options)
data = list_distributions(options).body

View file

@ -10,7 +10,7 @@ module Fog
attribute :routes, :aliases => 'routeSet'
attribute :associations, :aliases => 'associationSet'
attribute :tags, :aliases => 'tagSet'
def initialize(attributes={})
super
@ -50,7 +50,7 @@ module Fog
merge_attributes(new_attributes)
true
end
private
def associationSet=(new_association_set)

View file

@ -21,14 +21,14 @@ module Fog
attribute :ebs_optimized, :aliases => 'ebsOptimized'
attribute :groups
attribute :flavor_id, :aliases => 'instanceType'
attribute :hypervisor
attribute :hypervisor
attribute :iam_instance_profile, :aliases => 'iamInstanceProfile'
attribute :image_id, :aliases => 'imageId'
attr_accessor :instance_initiated_shutdown_behavior
attribute :kernel_id, :aliases => 'kernelId'
attribute :key_name, :aliases => 'keyName'
attribute :created_at, :aliases => 'launchTime'
attribute :lifecycle, :aliases => 'instanceLifecycle'
attribute :lifecycle, :aliases => 'instanceLifecycle'
attribute :monitoring, :squash => 'state'
attribute :placement_group, :aliases => 'groupName'
attribute :platform, :aliases => 'platform'
@ -186,7 +186,7 @@ module Fog
else
options["NetworkInterface.0.SecurityGroupId.0"] = options['SecurityGroupId']
end
options.delete('SecurityGroupId')
options.delete('SecurityGroupId')
if private_ip_address
options.delete('PrivateIpAddress')
options['NetworkInterface.0.PrivateIpAddress'] = private_ip_address

View file

@ -83,13 +83,13 @@ module Fog
)
end
end
security_group = service.security_groups.get(server.groups.first)
if security_group.nil?
raise Fog::Compute::AWS::Error, "The security group" \
" #{server.groups.first} doesn't exist."
end
# make sure port 22 is open in the first security group
authorized = security_group.ip_permissions.detect do |ip_permission|
ip_permission['ipRanges'].first && ip_permission['ipRanges'].first['cidrIp'] == '0.0.0.0/0' &&

View file

@ -4,19 +4,19 @@ module Fog
module AWS
class IAM
class Role < Fog::Model
identity :id, :aliases => 'RoleId'
attribute :rolename, :aliases => 'RoleName'
attribute :create_date, :aliases => 'CreateDate', :type => :time
attribute :assume_role_policy_document, :aliases => 'AssumeRolePolicyDocument'
attribute :arn, :aliases => 'Arn'
attribute :path, :aliases => 'Path'
def save
raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if persisted?
requires :rolename
requires :assume_role_policy_document
data = service.create_role(rolename, assume_role_policy_document).body["Role"]
merge_attributes(data)
true
@ -24,7 +24,7 @@ module Fog
def destroy
requires :rolename
service.delete_role(rolename)
true
end

View file

@ -5,7 +5,7 @@ module Fog
module Storage
class AWS
class File < Fog::Model
# @see AWS Object docs http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectOps.html
# @see AWS Object docs http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectOps.html
identity :key, :aliases => 'Key'
@ -30,12 +30,12 @@ module Fog
attr_accessor :multipart_chunk_size
# Set file's access control list (ACL).
#
#
# valid acls: private, public-read, public-read-write, authenticated-read, bucket-owner-read, bucket-owner-full-control
#
#
# @param [String] new_acl one of valid options
# @return [String] @acl
#
#
def acl=(new_acl)
valid_acls = ['private', 'public-read', 'public-read-write', 'authenticated-read', 'bucket-owner-read', 'bucket-owner-full-control']
unless valid_acls.include?(new_acl)
@ -45,9 +45,9 @@ module Fog
end
# Get file's body if exists, else ' '.
#
#
# @return [File]
#
#
def body
attributes[:body] ||= if last_modified && (file = collection.get(identity))
file.body
@ -57,31 +57,31 @@ module Fog
end
# Set body attribute.
#
#
# @param [File] new_body
# @return [File] attributes[:body]
#
#
def body=(new_body)
attributes[:body] = new_body
end
# Get the file instance's directory.
#
#
# @return [Fog::AWS::Storage::Directory]
#
#
def directory
@directory
end
# Copy object from one bucket to other bucket.
#
#
# required attributes: directory, key
#
#
# @param target_directory_key [String]
# @param target_file_key [String]
# @param options [Hash] options for copy_object method
# @return [String] Fog::AWS::Files#head status of directory contents
#
#
def copy(target_directory_key, target_file_key, options = {})
requires :directory, :key
service.copy_object(directory.key, key, target_directory_key, target_file_key, options)
@ -90,13 +90,13 @@ module Fog
end
# Destroy file via http DELETE.
#
#
# required attributes: directory, key
#
#
# @param options [Hash]
# @option options versionId []
# @return [Boolean] true if successful
#
#
def destroy(options = {})
requires :directory, :key
attributes[:body] = nil if options['versionId'] == version
@ -125,12 +125,12 @@ module Fog
end
# Set Access-Control-List permissions.
#
#
# valid new_publics: public_read, private
#
#
# @param [String] new_public
# @return [String] new_public
#
# @return [String] new_public
#
def public=(new_public)
if new_public
@acl = 'public-read'
@ -141,13 +141,13 @@ module Fog
end
# Get pubically acessible url via http GET.
# Checks persmissions before creating.
# Checks persmissions before creating.
# Defaults to s3 subdomain or compliant bucket name
#
#
# required attributes: directory, key
#
#
# @return [String] public url
#
#
def public_url
requires :directory, :key
if service.get_object_acl(directory.key, key).body['AccessControlList'].detect {|grant| grant['Grantee']['URI'] == 'http://acs.amazonaws.com/groups/global/AllUsers' && grant['Permission'] == 'READ'}
@ -161,10 +161,10 @@ module Fog
end
# Save file with body as contents to directory.key with name key via http PUT
#
#
# required attributes: body, directory, key
#
# @param [Hash] options
#
# @param [Hash] options
# @option options [String] acl sets x-amz-acl HTTP header. Valid values include, private | public-read | public-read-write | authenticated-read | bucket-owner-read | bucket-owner-full-control
# @option options [String] cache_control sets Cache-Control header. For example, 'No-cache'
# @option options [String] content_disposition sets Content-Disposition HTTP header. For exampple, 'attachment; filename=testing.txt'
@ -175,7 +175,7 @@ module Fog
# @option options [String] storage_class sets x-amz-storage-class HTTP header. Defaults to 'STANDARD'. Or, 'REDUCED_REDUNDANCY'
# @option options [String] encryption sets HTTP encryption header. Set to 'AES256' to encrypt files at rest on S3
# @return [Boolean] true if no errors
#
#
def save(options = {})
requires :body, :directory, :key
if options != {}
@ -206,21 +206,21 @@ module Fog
end
# Get a url for file.
#
#
# required attributes: key
#
#
# @param expires [String] number of seconds (since 1970-01-01 00:00) before url expires
# @param options [Hash]
# @return [String] url
#
#
def url(expires, options = {})
requires :key
collection.get_url(key, expires, options)
end
# File version if exists or creates new version.
# @return [Fog::Storage::AWS::Version]
#
# @return [Fog::Storage::AWS::Version]
#
def versions
@versions ||= begin
Fog::Storage::AWS::Versions.new(

View file

@ -10,7 +10,7 @@ module Fog
def start_element(name, attrs = [])
super
end
def end_element(name)
case name
when 'RequestId'

View file

@ -2,7 +2,7 @@ module Fog
module Parsers
module CDN
module AWS
class StreamingDistribution < Fog::Parsers::Base
def reset
@response = { 'StreamingDistributionConfig' => { 'CNAME' => [], 'Logging' => {}, 'TrustedSigners' => [] } }

View file

@ -19,7 +19,7 @@ module Fog
@in_parameters = true
when 'Capabilities'
@in_capabilities = true
end
end
end
def end_element(name)
@ -44,12 +44,12 @@ module Fog
@in_parameters = false
end
elsif @in_capabilities
case name
case name
when 'member'
@stack['Capabilities'] << value
@stack['Capabilities'] << value
when 'Capabilities'
@in_capabilities = false
end
end
else
case name
when 'member'

View file

@ -21,7 +21,7 @@ module Fog
when 'AlarmName', 'HistoryItemType', 'HistorySummary'
@alarm_history_item[name] = value
when 'Timestamp'
@alarm_history_item[name] = Time.parse value
@alarm_history_item[name] = Time.parse value
when 'RequestId'
@response['ResponseMetadata'][name] = value
when 'NextToken'

View file

@ -18,7 +18,7 @@ module Fog
def start_element(name, attrs = [])
super
case name
case name
when 'Dimensions'
@in_dimensions = true
when 'member'

View file

@ -18,7 +18,7 @@ module Fog
def start_element(name, attrs = [])
super
case name
case name
when 'Dimensions'
@in_dimensions = true
when 'member'
@ -44,7 +44,7 @@ module Fog
when 'StateUpdatedTimestamp', 'AlarmConfigurationUpdatedTimestamp'
@metric_alarms[name] = Time.parse value
when 'Dimensions'
@in_dimensions = false
@in_dimensions = false
when 'NextToken'
@response['ResponseMetadata'][name] = value
when 'RequestId'

View file

@ -17,7 +17,7 @@ module Fog
@response['ResponseMetadata'][name] = value
end
end
end
end
end
end
end

View file

@ -17,7 +17,7 @@ module Fog
@response['ResponseMetadata'][name] = value
end
end
end
end
end
end
end

View file

@ -17,7 +17,7 @@ module Fog
@response['ResponseMetadata'][name] = value
end
end
end
end
end
end
end

View file

@ -38,14 +38,14 @@ module Fog
case name
when 'item'
unless @in_value_set
@dhcp_options['dhcpConfigurationSet'][@dhcp_configuration['key']] = @value_set
@dhcp_options['dhcpConfigurationSet'][@dhcp_configuration['key']] = @value_set
@value_set=[]
@dhcp_configuration = {}
end
when 'key', 'value'
if !@in_value_set
@dhcp_configuration[name] = value
else
@dhcp_configuration[name] = value
else
@value_set << value
end
when 'valueSet'

View file

@ -38,14 +38,14 @@ module Fog
case name
when 'item'
unless @in_value_set
@dhcp_options['dhcpConfigurationSet'][@dhcp_configuration['key']] = @value_set
@dhcp_options['dhcpConfigurationSet'][@dhcp_configuration['key']] = @value_set
@value_set=[]
@dhcp_configuration = {}
end
when 'key', 'value'
if !@in_value_set
@dhcp_configuration[name] = value
else
@dhcp_configuration[name] = value
else
@value_set << value
end
when 'valueSet'

View file

@ -32,7 +32,7 @@ module Fog
when 'architecture', 'clientToken', 'dnsName', 'hypervisor', 'imageId',
'instanceId', 'instanceType', 'ipAddress', 'kernelId', 'keyName',
'instanceLifecycle', 'platform', 'privateDnsName', 'privateIpAddress', 'ramdiskId',
'reason', 'requesterId', 'rootDeviceType',
'reason', 'requesterId', 'rootDeviceType',
'spotInstanceRequestId', 'virtualizationType'
@instance[name] = value
when 'attachTime'

View file

@ -8,7 +8,7 @@ module Fog
@association = {}
@entry = { 'icmpTypeCode' => {}, 'portRange' => {} }
@tag = {}
@in_entry_set = false
@in_association_set = false
@in_tag_set = false

View file

@ -39,7 +39,7 @@ module Fog
when 'member'
@response['Users'] << @user
@user = {}
when 'IsTruncated'
when 'IsTruncated'
response[name] = (value == 'true')
when 'Marker', 'RequestId'
@response[name] = value

View file

@ -56,7 +56,7 @@ module Fog
request :describe_db_log_files
request :download_db_logfile_portion
request :promote_read_replica
model_path 'fog/aws/models/rds'

View file

@ -25,7 +25,7 @@ module Fog
def associate_address(*args)
if args.first.kind_of? Hash
params = args.first
else
else
params = {
:instance_id => args[0],
:public_ip => args[1],
@ -57,7 +57,7 @@ module Fog
def associate_address(*args)
if args.first.kind_of? Hash
params = args.first
else
else
params = {
:instance_id => args[0],
:public_ip => args[1],

View file

@ -21,7 +21,7 @@ def test
rescue
puts "Failed to create disk #{name}-#{i}"
end
begin
server = gce.servers.create(
name: "#{name}-#{i}",
@ -67,7 +67,7 @@ def test
puts "Failed to create forwarding rule #{name}"
end
# TODO(bensonk): Install apache, create individualized htdocs, and run some
# actual requests through the load balancer.

View file

@ -73,7 +73,7 @@ module Fog
# - Also, for DNS compliance, you should not have a period adjacent to another period or dash. For example, ".." or "-." or ".-" are not acceptable.
Fog::Logger.warning("fog: the specified google storage bucket name (#{subdomain}) is not a valid dns name. See: https://developers.google.com/storage/docs/bucketnaming") unless @path_style
end
params[:host] = params[:host].split("#{subdomain}.")[-1]
if params[:path]
params[:path] = "#{subdomain}/#{params[:path]}"

View file

@ -121,13 +121,13 @@ module Fog
# Return them all, leading with manually assigned addresses
manual = all_addresses.map{|addr| addr["ip"]}
all_floating.sort{ |a,b|
all_floating.sort{ |a,b|
a_manual = manual.include? a
b_manual = manual.include? b
if a_manual and !b_manual
if a_manual and !b_manual
-1
elsif !a_manual and b_manual
elsif !a_manual and b_manual
1
else 0 end
}

View file

@ -7,11 +7,11 @@ module Fog
# @!attribute [r] group
# @return [Fog::Rackspace::AutoScale::Group] The parent group
attribute :group
# @!attribute [r] type
# @return [Fog::Rackspace::AutoScale::Group] The type of operation (usually "launch_server")
attribute :type
# @!attribute [r] args
# @return [Fog::Rackspace::AutoScale::Group] The arguments for the operation
attribute :args

View file

@ -551,7 +551,7 @@ module Fog
# @note Though Rackspace does not enforce complexity requirements for the password, the operating system might. If the password is not complex enough, the server might enter an ERROR state.
# @see http://docs.rackspace.com/servers/api/v2/cs-devguide/content/Change_Password-d1e3234.html
#
# * Status Transition:
# * Status Transition:
# * ACTIVE -> PASSWORD -> ACTIVE
# * ACTIVE -> PASSWORD -> ERROR (on error)
def change_admin_password(password)

View file

@ -14,7 +14,7 @@ module Fog
requires :entity
data = service.list_checks(entity.identity, options).body
self.marker = data['metadata']['next_marker']
load(data['values'])
end

View file

@ -18,9 +18,9 @@ Shindo.tests('AWS | credentials', ['aws']) do
Excon.stub({:method => :get, :path => "/latest/meta-data/iam/security-credentials/arole"}, {:status => 200, :body => Fog::JSON.encode(credentials)})
tests("#fetch_credentials") do
returns({:aws_access_key_id => 'dummykey',
:aws_secret_access_key => 'dummysecret',
:aws_session_token => 'dummytoken',
returns({:aws_access_key_id => 'dummykey',
:aws_secret_access_key => 'dummysecret',
:aws_session_token => 'dummytoken',
:aws_credentials_expire_at => expires_at}) { Fog::Compute::AWS.fetch_credentials(:use_iam_profile => true) }
end

View file

@ -14,11 +14,11 @@ Shindo.tests('AWS::AutoScaling | group', ['aws', 'auto_scaling_m']) do
}
Fog::AWS[:auto_scaling].configurations.new(lc_params).save
model_tests(Fog::AWS[:auto_scaling].groups, params, true) do
@instance.update
end
test("setting attributes in the constructor") do
group = Fog::AWS[:auto_scaling].groups.new(:min_size => 1, :max_size => 2)
group.min_size == 1 && group.max_size == 2

View file

@ -2,7 +2,7 @@ Shindo.tests("AWS::CloudWatch | metric_statistics", ['aws', 'cloudwatch']) do
tests('success') do
pending if Fog.mocking?
instanceId = 'i-420c352f'
metricName = 'DiskReadBytes'
namespace = 'AWS/EC2'
@ -10,15 +10,15 @@ Shindo.tests("AWS::CloudWatch | metric_statistics", ['aws', 'cloudwatch']) do
endTime = Time.now.iso8601
period = 60
statisticTypes = ['Minimum','Maximum','Sum','SampleCount','Average']
tests("#all").succeeds do
@statistics = Fog::AWS[:cloud_watch].metric_statistics.all({'Statistics' => statisticTypes, 'StartTime' => startTime, 'EndTime' => endTime, 'Period' => period, 'MetricName' => metricName, 'Namespace' => namespace, 'Dimensions' => [{'Name' => 'InstanceId', 'Value' => instanceId}]})
end
tests("#all_not_empty").returns(true) do
@statistics.length > 0
end
new_attributes = {
:namespace => 'Custom/Test',
:metric_name => 'ModelTest',
@ -28,11 +28,11 @@ Shindo.tests("AWS::CloudWatch | metric_statistics", ['aws', 'cloudwatch']) do
tests('#new').returns(new_attributes) do
Fog::AWS[:cloud_watch].metric_statistics.new(new_attributes).attributes
end
tests('#create').returns(new_attributes) do
Fog::AWS[:cloud_watch].metric_statistics.create(new_attributes).attributes
end
stats_set_attributes = {
:namespace => 'Custom/Test',
:metric_name => 'ModelTest',

View file

@ -11,13 +11,13 @@ Shindo.tests("AWS::CloudWatch | metrics", ['aws', 'cloudwatch']) do
tests("#get").returns({:dimensions=>[{"Name"=>"InstanceId", "Value"=>instanceId}], :name=>metricName, :namespace=>namespace}) do
Fog::AWS[:cloud_watch].metrics.get(namespace, metricName, {'InstanceId' => instanceId}).attributes
end
end
tests('#each') do
Fog.mock!
tests("handle NextToken").returns(1001) do
count = 0
count = 0
Fog::AWS[:cloud_watch].metrics.each {|e| count += 1 }
count
end

View file

@ -105,5 +105,5 @@ Shindo.tests("Fog::Compute[:aws] | network_acl", ['aws']) do
end
@subnet.destroy
@vpc.destroy
@vpc.destroy
end

View file

@ -2,6 +2,6 @@ Shindo.tests("Fog::Compute[:aws] | network_acls", ['aws']) do
@vpc = Fog::Compute[:aws].vpcs.create('cidr_block' => '10.0.10.0/24')
collection_tests(Fog::Compute[:aws].network_acls, { :vpc_id => @vpc.id }, true)
@vpc.destroy
end

View file

@ -6,7 +6,7 @@ Shindo.tests("Fog::Compute[:aws] | network_interfaces", ['aws']) do
collection_tests(Fog::Compute[:aws].network_interfaces,
{:description => 'nic_desc', :name => 'nic_name', :subnet_id => @subnet_id},
true)
@subnet.destroy
@vpc.destroy
end

View file

@ -26,7 +26,7 @@ Shindo.tests("Fog::Compute[:aws] | monitor", ['aws']) do
test('#associate_public_ip = false') do
@instance.associate_public_ip = false
@instance.associate_public_ip == false
end
end
end

View file

@ -2,16 +2,16 @@ Shindo.tests("Fog::Compute[:iam] | access_keys", ['aws','iam']) do
Fog.mock!
iam = Fog::AWS[:iam]
@username = 'fake_user'
@user = iam.users.create(:id => @username)
tests('#all', 'there are no access keys for a new user').succeeds do
@user.access_keys.empty?
end
tests('#create','an access key').succeeds do
access_key = @user.access_keys.create
access_key.id =~ /[A-Z0-9]{20}/
@ -20,13 +20,13 @@ Shindo.tests("Fog::Compute[:iam] | access_keys", ['aws','iam']) do
access_key.username == @username
@access_key_id = access_key.id
end
@user.access_keys.create
tests('#all','there are two access keys').succeeds do
@user.access_keys.size == 2
end
tests('#get') do
tests('a valid access key id').succeeds do
access_key = @user.access_keys.get(@access_key_id)
@ -35,19 +35,19 @@ Shindo.tests("Fog::Compute[:iam] | access_keys", ['aws','iam']) do
access_key.status == "Active"
access_key.username == @username
end
tests('an invalid access key').succeeds do
@user.access_keys.get('non-existing') == nil
end
end
tests('#destroy', 'decrease by one the number of access keys').succeeds do
size = @user.access_keys.size
@user.access_keys.get(@access_key_id).destroy
@user.access_keys.size == ( size - 1 )
end
# clean up
@user.destroy
end

View file

@ -2,55 +2,55 @@ Shindo.tests("Fog::Compute[:iam] | policies", ['aws','iam']) do
Fog.mock!
iam = Fog::AWS[:iam]
@username = 'fake_user'
@user = iam.users.create(:id => @username)
@policy_document = {"Statement"=>[{"Action"=>["sqs:*"], "Effect"=>"Allow", "Resource"=>"*"}]}
@policy_name = 'fake-sqs-policy'
tests('#all', 'there is no policies').succeeds do
@user.policies.empty?
end
tests('#create') do
tests('#create') do
tests('a valid policy').succeeds do
policy = @user.policies.create(:id => @policy_name, :document => @policy_document)
policy.id == @policy_name
policy.username == @username
policy.document == @policy_document
end
# The mocking doesn't validate the document policy
#tests('an invalid valid policy').succeeds do
# raises(Fog::AWS::IAM::Error) { @user.policies.create(id: 'non-valid-document', document: 'invalid json blob') }
#end
end
@user.policies.create(:id => 'another-policy', :document => {})
tests('#all','there are two policies').succeeds do
@user.policies.size == 2
end
tests('#get') do
tests('a valid policy').succeeds do
policy = @user.policies.get(@policy_name)
policy.id == @polic_name
policy.username == @username
policy.document == @policy_document
policy.document == @policy_document
end
tests('an invalid policy').succeeds do
@user.policies.get('non-existing') == nil
end
end
tests('#destroy').succeeds do
@user.policies.get(@policy_name).destroy
end
# clean up
@user.destroy
end

View file

@ -1,7 +1,7 @@
Shindo.tests("Fog::Compute[:iam] | roles", ['aws','iam']) do
pending if Fog.mocking?
@iam = Fog::AWS[:iam]
@role_one_name = 'fake_role_one'
@role_two_name = 'fake_role_two'
@ -18,15 +18,15 @@ Shindo.tests("Fog::Compute[:iam] | roles", ['aws','iam']) do
tests('#all','there is only one role').succeeds do
@iam.roles.size == 1
end
tests('#all','the only role should match').succeeds do
@iam.roles.first.rolename == @role_one_name
end
tests('#create','a second role').succeeds do
@role_two = @iam.roles.create(:rolename => @role_two_name)
@role_two.rolename == @role_two_name
end
end
tests('#all','there are two roles').succeeds do
@iam.roles.size == 2
@ -39,7 +39,7 @@ Shindo.tests("Fog::Compute[:iam] | roles", ['aws','iam']) do
tests('#get',"returns nil if the role doesn't exists").succeeds do
@iam.roles.get('non-exists') == nil
end
tests('#create', 'assigns path').succeeds do
@role_three = @iam.roles.create(:rolename => @role_three_name, :path => @role_three_path)
@role_three.path == @role_three_path
@ -53,11 +53,11 @@ Shindo.tests("Fog::Compute[:iam] | roles", ['aws','iam']) do
tests('#destroy','an existing role').succeeds do
@iam.roles.get(@role_one_name).destroy
end
tests('#destroy','clean up remaining roles').succeeds do
@iam.roles.get(@role_two_name).destroy
@iam.roles.get(@role_three_name).destroy
@iam.roles.get(@role_four_name).destroy
end
end

View file

@ -17,15 +17,15 @@ Shindo.tests("Fog::Compute[:iam] | users", ['aws','iam']) do
tests('#all','there is only one user').succeeds do
@iam.users.size == 1
end
tests('#all','the only user should match').succeeds do
@iam.users.first.id == @user_one_name
end
tests('#create','a second user').succeeds do
@user_two = @iam.users.create(:id => @user_two_name)
@user_two.id == @user_two_name
end
end
tests('#all','there are two users').succeeds do
@iam.users.size == 2
@ -38,15 +38,15 @@ Shindo.tests("Fog::Compute[:iam] | users", ['aws','iam']) do
tests('#get',"returns nil if the user doesn't exists").succeeds do
@iam.users.get('non-exists') == nil
end
tests('#policies','it has no policies').succeeds do
@iam.users.get(@user_one_name).policies.empty?
end
tests('#access_keys','it has no keys').succeeds do
@iam.users.get(@user_one_name).access_keys.empty?
end
tests('#create', 'assigns path').succeeds do
@user_three = @iam.users.create(:id => @user_three_name, :path => @user_three_path)
@user_three.path == @user_three_path
@ -60,9 +60,9 @@ Shindo.tests("Fog::Compute[:iam] | users", ['aws','iam']) do
tests('#destroy','an existing user').succeeds do
@iam.users.get(@user_one_name).destroy
end
tests('#destroy','clean up remaining user').succeeds do
@iam.users.get(@user_two_name).destroy
end
end

View file

@ -10,7 +10,7 @@ Shindo.tests('AWS | url', ["aws"]) do
:aws_secret_access_key => 'abc',
:region => 'us-east-1'
)
@file = @storage.directories.new(:key => 'fognonbucket').files.new(:key => 'test.txt')
if Fog.mock?

View file

@ -12,7 +12,7 @@ Shindo.tests('AWS::CloudWatch | metric requests', ['aws', 'cloudwatch']) do
'Average' => Float,
'Sum' => Float,
'SampleCount' => Float
}],
}],
},
'ResponseMetadata' => {
'RequestId' => String

View file

@ -31,7 +31,7 @@ Shindo.tests('Fog::Compute[:aws] | internet_gateway requests', ['aws']) do
tests('failure') do
Fog::Compute::AWS::Mock.reset if Fog.mocking?
@vpc=Fog::Compute[:aws].vpcs.create('cidr_block' => '10.0.10.0/24')
@vpc_id = @vpc.id

View file

@ -39,7 +39,7 @@ Shindo.tests('Fog::Compute[:aws] | image requests', ['aws']) do
'requestId' => String,
'imageId' => String
}
@image_copy_result = {
'requestId' => String,
'imageId' => String
@ -73,7 +73,7 @@ Shindo.tests('Fog::Compute[:aws] | image requests', ['aws']) do
Fog::Compute[:aws].images.get(create_image_response.body['imageId']) != nil
end
@server.destroy
tests("#copy_image (#{@image_id}, 'eu-west-1')").formats(@image_copy_result) do
data = Fog::Compute.new(:provider => :aws, :region => "us-west-1", :version => "2013-02-01").copy_image(@image_id, "eu-east-1").body
@eu_image_id = data['imageId']
@ -133,7 +133,7 @@ Shindo.tests('Fog::Compute[:aws] | image requests', ['aws']) do
Fog::Compute[:aws].describe_images('Owner' => @other_image['imageOwnerAlias'], 'image-id' => @image_id).body
end
end
#NOTE: waiting for the image to complete can sometimes take up to 1 hour
# for quicker tests: uncomment the rest of this block
#Fog.wait_for { Fog::Compute.new(:provider => :aws, :region => "us-west-1").snapshots.get(@eu_image_id) }
@ -141,7 +141,7 @@ Shindo.tests('Fog::Compute[:aws] | image requests', ['aws']) do
#tests("#delete_snapshots(#{@eu_image_id})").formats(AWS::Compute::Formats::BASIC) do
# Fog::Compute.new(:provider => :aws, :region => "us-west-1").delete_snapshot(@eu_image_id).body
#end
end
tests('failure') do

View file

@ -26,7 +26,7 @@ Shindo.tests('Fog::Compute[:aws] | internet_gateway requests', ['aws']) do
tests('#describe_internet_gateways').formats(@internet_gateways_format) do
Fog::Compute[:aws].describe_internet_gateways.body
end
tests('#describe_internet_gateways with tags').formats(@internet_gateways_format) do
Fog::Compute[:aws].create_tags @igw_id, {"environment" => "production"}
Fog::Compute[:aws].describe_internet_gateways.body

View file

@ -35,7 +35,7 @@ Shindo.tests('Fog::Compute[:aws] | network acl requests', ['aws']) do
tests('success') do
Fog::Compute::AWS::Mock.reset if Fog.mocking?
@vpc = Fog::Compute[:aws].vpcs.create('cidr_block' => '10.0.10.0/24')
@subnet = Fog::Compute[:aws].subnets.create('vpc_id' => @vpc.id, 'cidr_block' => '10.0.10.16/28')
@network_acl = nil

View file

@ -21,12 +21,12 @@ Shindo.tests('Fog::Compute[:aws] | region requests', ['aws']) do
tests("#incorrect_region") do
raises(ArgumentError, "Unknown region: world-antarctica-1") do
Fog::Compute::AWS.new({:aws_access_key_id => 'dummykey',
:aws_secret_access_key => 'dummysecret',
Fog::Compute::AWS.new({:aws_access_key_id => 'dummykey',
:aws_secret_access_key => 'dummysecret',
:aws_session_token => 'dummytoken',
:region => "world-antarctica-1"})
end
end
end

View file

@ -4,8 +4,8 @@ Shindo.tests('Fog::AWS[:dynamodb] | item requests', ['aws']) do
unless Fog.mocking?
Fog::AWS[:dynamodb].create_table(
@table_name,
{'HashKeyElement' => {'AttributeName' => 'key', 'AttributeType' => 'S'}},
@table_name,
{'HashKeyElement' => {'AttributeName' => 'key', 'AttributeType' => 'S'}},
{'ReadCapacityUnits' => 5, 'WriteCapacityUnits' => 5}
)
Fog.wait_for { Fog::AWS[:dynamodb].describe_table(@table_name).body['Table']['TableStatus'] == 'ACTIVE' }

View file

@ -81,7 +81,7 @@ class AWS
'SourceType' => String,
}
EVENT_LIST = [EVENT]
RESERVED_CACHE_CLUSTER = {
'CacheNodeCount' => Integer,
'CacheNodeType' => String,
@ -97,7 +97,7 @@ class AWS
'UsagePrice' => Float
}
RESERVED_CACHE_CLUSTER_LIST = [RESERVED_CACHE_CLUSTER]
end
end
end

View file

@ -126,7 +126,7 @@ Shindo.tests('AWS::ELB | policy_tests', ['aws', 'elb']) do
description = Fog::AWS[:elb].describe_load_balancers("LoadBalancerNames" => [@load_balancer_id]).body["DescribeLoadBalancersResult"]["LoadBalancerDescriptions"].first
returns(true) { description["Policies"]["OtherPolicies"].include?(proxy_policy) }
end
Fog::AWS[:elb].delete_load_balancer(@load_balancer_id)
end
end

View file

@ -8,12 +8,12 @@ class AWS
RUN_JOB_FLOW = BASIC.merge({
'JobFlowId' => String
})
ADD_INSTANCE_GROUPS = {
'JobFlowId' => String,
'InstanceGroupIds' => Array
}
SIMPLE_DESCRIBE_JOB_FLOW = {
'JobFlows' => [{
'Name' => String,
@ -59,7 +59,7 @@ class AWS
}
}]
}
JOB_FLOW_WITHOUT_CHANGE = {
'JobFlows' => [{
'Name' => String,
@ -105,7 +105,7 @@ class AWS
}
}]
}
DESCRIBE_JOB_FLOW_WITH_INSTANCE_GROUPS = {
'JobFlows' => [{
'Name' => String,

View file

@ -23,7 +23,7 @@ Shindo.tests('AWS::Glacier | glacier archive tests', ['aws']) do
archive = Fog::AWS[:glacier].complete_multipart_upload('Fog-Test-Vault-upload', id, 2*1024*1024, hash.hexdigest).headers['x-amz-archive-id']
Fog::AWS[:glacier].delete_archive('Fog-Test-Vault-upload', archive)
Fog::AWS[:glacier].delete_archive('Fog-Test-Vault-upload', archive)
#amazon won't let us delete the vault because it has been written to in the past day
end
end

View file

@ -9,11 +9,11 @@ Shindo.tests('AWS::IAM | user requests', ['aws']) do
'LoginProfile' => {
'UserName' => String,
'CreateDate' => Time
},
'RequestId' => String
}
tests("#create_login_profile('fog_user')").formats(@login_profile_format) do
pending if Fog.mocking?
Fog::AWS[:iam].create_login_profile('fog_user', 'somepassword').body

View file

@ -53,7 +53,7 @@ Shindo.tests('AWS::IAM | role requests', ['aws']) do
'Roles' => [@role]
},
'RequestId' => String
}
tests("#create_instance_profile('fogprofile')").formats(@profile_format) do
pending if Fog.mocking?
@ -81,12 +81,12 @@ Shindo.tests('AWS::IAM | role requests', ['aws']) do
}],
'IsTruncated' => Fog::Boolean,
'RequestId' => String
}
tests("list_instance_profiles_for_role('fogrole')").formats(@profiles_format) do
pending if Fog.mocking?
body = Fog::AWS[:iam].list_instance_profiles_for_role('fogrole').body
returns(['fogprofile']) { body['InstanceProfiles'].collect {|hash| hash['InstanceProfileName']}}
returns(['fogprofile']) { body['InstanceProfiles'].collect {|hash| hash['InstanceProfileName']}}
body
end
@ -96,7 +96,7 @@ Shindo.tests('AWS::IAM | role requests', ['aws']) do
end
sample_policy = {"Statement" => [{"Effect" => "Allow", "Action" => "*", "Resource" => "*"}]}
tests("put_role_policy").formats(AWS::IAM::Formats::BASIC) do
pending if Fog.mocking?
Fog::AWS[:iam].put_role_policy('fogrole', 'fogpolicy', sample_policy).body
@ -104,7 +104,7 @@ Shindo.tests('AWS::IAM | role requests', ['aws']) do
@get_role_policy_format = {
'Policy' => {
'RoleName' => String,
'RoleName' => String,
'PolicyName' => String,
'PolicyDocument' => Hash,
},
@ -122,7 +122,7 @@ Shindo.tests('AWS::IAM | role requests', ['aws']) do
@list_role_policies_format = {
'PolicyNames' => [String],
'IsTruncated' => Fog::Boolean,
'RequestId' => String
'RequestId' => String
}
tests("list_role_policies").formats(@list_role_policies_format) do
@ -137,7 +137,7 @@ Shindo.tests('AWS::IAM | role requests', ['aws']) do
pending if Fog.mocking?
Fog::AWS[:iam].delete_role_policy('fogrole', 'fogpolicy').body
end
returns([]) do
pending if Fog.mocking?
Fog::AWS[:iam].list_role_policies('fogrole').body['PolicyNames']

View file

@ -11,6 +11,6 @@ Shindo.tests('AWS::RDS | describe DB events requests',['aws', 'rds']) do
end
tests('failure') do
#TODO: What constitutes a failure here?
#TODO: What constitutes a failure here?
end
end

View file

@ -7,26 +7,26 @@ Shindo.tests('AWS::RDS | parameter group requests', ['aws', 'rds']) do
returns( 'mysql5.1') { body['CreateDBParameterGroupResult']['DBParameterGroup']['DBParameterGroupFamily']}
returns( 'fog-group') { body['CreateDBParameterGroupResult']['DBParameterGroup']['DBParameterGroupName']}
returns( 'Some description') { body['CreateDBParameterGroupResult']['DBParameterGroup']['Description']}
body
end
Fog::AWS[:rds].create_db_parameter_group('other-fog-group', 'MySQL5.1', 'Some description')
tests("#describe_db_parameter_groups").formats(AWS::RDS::Formats::DESCRIBE_DB_PARAMETER_GROUP) do
body = Fog::AWS[:rds].describe_db_parameter_groups().body
returns(4) {body['DescribeDBParameterGroupsResult']['DBParameterGroups'].length}
returns(4) {body['DescribeDBParameterGroupsResult']['DBParameterGroups'].length}
body
end
tests("#describe_db_parameter_groups('fog-group)").formats(AWS::RDS::Formats::DESCRIBE_DB_PARAMETER_GROUP) do
body = Fog::AWS[:rds].describe_db_parameter_groups('fog-group').body
returns(1) {body['DescribeDBParameterGroupsResult']['DBParameterGroups'].length}
returns(1) {body['DescribeDBParameterGroupsResult']['DBParameterGroups'].length}
group = body['DescribeDBParameterGroupsResult']['DBParameterGroups'].first
returns( 'mysql5.1') { group['DBParameterGroupFamily']}
returns( 'fog-group') { group['DBParameterGroupName']}
@ -34,10 +34,10 @@ Shindo.tests('AWS::RDS | parameter group requests', ['aws', 'rds']) do
body
end
tests("delete_db_parameter_group").formats(AWS::RDS::Formats::BASIC) do
body = Fog::AWS[:rds].delete_db_parameter_group('fog-group').body
raises(Fog::AWS::RDS::NotFound) {Fog::AWS[:rds].describe_db_parameter_groups('fog-group')}
body
@ -54,9 +54,9 @@ Shindo.tests('AWS::RDS | parameter group requests', ['aws', 'rds']) do
Fog::AWS[:rds].create_db_parameter_group('fog-group', 'MySQL5.1', 'Some description')
raises(Fog::AWS::RDS::IdentifierTaken) {Fog::AWS[:rds].create_db_parameter_group('fog-group', 'MySQL5.1', 'Some description')}
end
Fog::AWS[:rds].delete_db_parameter_group('fog-group')
end
end

View file

@ -1,19 +1,19 @@
Shindo.tests('AWS::RDS | parameter requests', ['aws', 'rds']) do
tests('success') do
pending if Fog.mocking?
Fog::AWS[:rds].create_db_parameter_group('fog-group', 'MySQL5.1', 'Some description')
tests('#modify_db_parameter_group').formats(AWS::RDS::Formats::MODIFY_PARAMETER_GROUP) do
body = Fog::AWS[:rds].modify_db_parameter_group('fog-group',[
{'ParameterName' => 'query_cache_size',
'ParameterValue' => '12345',
'ApplyMethod' => 'immediate'}
'ApplyMethod' => 'immediate'}
]).body
body
end
tests('#describe_db_parameters').formats(AWS::RDS::Formats::DESCRIBE_DB_PARAMETERS) do
Fog::AWS[:rds].describe_db_parameters('fog-group', :max_records => 20).body
end
@ -21,7 +21,7 @@ Shindo.tests('AWS::RDS | parameter requests', ['aws', 'rds']) do
tests("#describe_db_parameters :source => 'user'")do
body = Fog::AWS[:rds].describe_db_parameters('fog-group', :source => 'user').body
returns(1){ body['DescribeDBParametersResult']['Parameters'].length}
param = body['DescribeDBParametersResult']['Parameters'].first
returns('query_cache_size'){param['ParameterName']}
returns('12345'){param['ParameterValue']}
@ -29,6 +29,6 @@ Shindo.tests('AWS::RDS | parameter requests', ['aws', 'rds']) do
returns('query_cache_size'){param['ParameterName']}
end
Fog::AWS[:rds].delete_db_parameter_group('fog-group')
end
end

View file

@ -7,7 +7,7 @@ Shindo.tests('AWS::RDS | security group requests', ['aws', 'rds']) do
else
@owner_id = Fog::AWS[:rds].security_groups.get('default').owner_id
end
tests('success') do
tests("#create_db_security_group").formats(AWS::RDS::Formats::CREATE_DB_SECURITY_GROUP) do
@ -17,82 +17,82 @@ Shindo.tests('AWS::RDS | security group requests', ['aws', 'rds']) do
returns( 'Some description') { body['CreateDBSecurityGroupResult']['DBSecurityGroup']['DBSecurityGroupDescription']}
returns( []) { body['CreateDBSecurityGroupResult']['DBSecurityGroup']['EC2SecurityGroups']}
returns( []) { body['CreateDBSecurityGroupResult']['DBSecurityGroup']['IPRanges']}
body
end
tests("#describe_db_security_groups").formats(AWS::RDS::Formats::DESCRIBE_DB_SECURITY_GROUP) do
Fog::AWS[:rds].describe_db_security_groups.body
end
tests("#authorize_db_security_group_ingress CIDR").formats(AWS::RDS::Formats::AUTHORIZE_DB_SECURITY_GROUP) do
@cidr = '0.0.0.0/0'
body = Fog::AWS[:rds].authorize_db_security_group_ingress(@sec_group_name,{'CIDRIP'=>@cidr}).body
returns("authorizing") { body['AuthorizeDBSecurityGroupIngressResult']['DBSecurityGroup']['IPRanges'].detect{|h| h['CIDRIP'] == @cidr}['Status']}
body
end
sec_group = Fog::AWS[:rds].security_groups.get(@sec_group_name)
sec_group.wait_for {ready?}
tests("#authorize_db_security_group_ingress another CIDR").formats(AWS::RDS::Formats::AUTHORIZE_DB_SECURITY_GROUP) do
@cidr = "10.0.0.0/24"
body = Fog::AWS[:rds].authorize_db_security_group_ingress(@sec_group_name,{'CIDRIP'=>@cidr}).body
returns("authorizing") { body['AuthorizeDBSecurityGroupIngressResult']['DBSecurityGroup']['IPRanges'].detect{|h| h['CIDRIP'] == @cidr}['Status']}
body
end
sec_group = Fog::AWS[:rds].security_groups.get(@sec_group_name)
sec_group.wait_for {ready?}
tests("#count CIDRIP").formats(AWS::RDS::Formats::DESCRIBE_DB_SECURITY_GROUP) do
body = Fog::AWS[:rds].describe_db_security_groups(@sec_group_name).body
returns(2) { body['DescribeDBSecurityGroupsResult']['DBSecurityGroups'][0]['IPRanges'].size }
body
end
tests("#revoke_db_security_group_ingress CIDR").formats(AWS::RDS::Formats::REVOKE_DB_SECURITY_GROUP) do
@cidr = '0.0.0.0/0'
body = Fog::AWS[:rds].revoke_db_security_group_ingress(@sec_group_name,{'CIDRIP'=> @cidr}).body
returns("revoking") { body['RevokeDBSecurityGroupIngressResult']['DBSecurityGroup']['IPRanges'].detect{|h| h['CIDRIP'] == @cidr}['Status']}
body
end
tests("#authorize_db_security_group_ingress EC2").formats(AWS::RDS::Formats::AUTHORIZE_DB_SECURITY_GROUP) do
@ec2_sec_group = 'default'
body = Fog::AWS[:rds].authorize_db_security_group_ingress(@sec_group_name,{'EC2SecurityGroupName' => @ec2_sec_group, 'EC2SecurityGroupOwnerId' => @owner_id}).body
returns("authorizing") { body['AuthorizeDBSecurityGroupIngressResult']['DBSecurityGroup']['EC2SecurityGroups'].detect{|h| h['EC2SecurityGroupName'] == @ec2_sec_group}['Status']}
returns(@owner_id) { body['AuthorizeDBSecurityGroupIngressResult']['DBSecurityGroup']['EC2SecurityGroups'].detect{|h| h['EC2SecurityGroupName'] == @ec2_sec_group}['EC2SecurityGroupOwnerId']}
body
end
tests("duplicate #authorize_db_security_group_ingress EC2").raises(Fog::AWS::RDS::AuthorizationAlreadyExists) do
@ec2_sec_group = 'default'
Fog::AWS[:rds].authorize_db_security_group_ingress(@sec_group_name,{'EC2SecurityGroupName' => @ec2_sec_group, 'EC2SecurityGroupOwnerId' => @owner_id})
end
sec_group = Fog::AWS[:rds].security_groups.get(@sec_group_name)
sec_group.wait_for {ready?}
tests("#revoke_db_security_group_ingress EC2").formats(AWS::RDS::Formats::REVOKE_DB_SECURITY_GROUP) do
@ec2_sec_group = 'default'
body = Fog::AWS[:rds].revoke_db_security_group_ingress(@sec_group_name,{'EC2SecurityGroupName' => @ec2_sec_group, 'EC2SecurityGroupOwnerId' => @owner_id}).body
returns("revoking") { body['RevokeDBSecurityGroupIngressResult']['DBSecurityGroup']['EC2SecurityGroups'].detect{|h| h['EC2SecurityGroupName'] == @ec2_sec_group}['Status']}
body
end
#TODO, authorize ec2 security groups
tests("#delete_db_security_group").formats(AWS::RDS::Formats::BASIC) do
body = Fog::AWS[:rds].delete_db_security_group(@sec_group_name).body
raises(Fog::AWS::RDS::NotFound) {Fog::AWS[:rds].describe_db_security_groups(@sec_group_name)}
body

View file

@ -37,8 +37,8 @@ Shindo.tests('Fog::Redshift[:aws] | cluster parameter group requests', ['aws'])
tests('success') do
tests("create_cluster_parameter_group").formats(@cluster_parameter_group_format) do
body = Fog::AWS[:redshift].create_cluster_parameter_group(:parameter_group_name=> parameter_group,
:parameter_group_family=>"redshift-1.0",
body = Fog::AWS[:redshift].create_cluster_parameter_group(:parameter_group_name=> parameter_group,
:parameter_group_family=>"redshift-1.0",
:description=>'testing').body
body
end
@ -54,14 +54,14 @@ Shindo.tests('Fog::Redshift[:aws] | cluster parameter group requests', ['aws'])
end
tests("modify_cluster_parameter_groups").formats(@modify_cluster_parameter_group_format) do
body = Fog::AWS[:redshift].modify_cluster_parameter_group(:parameter_group_name=>parameter_group,
body = Fog::AWS[:redshift].modify_cluster_parameter_group(:parameter_group_name=>parameter_group,
:parameters=>{
:parameter_name=>'extra_float_digits',
:parameter_value=>2}).body
body
end
tests("delete_cluster_parameter_group") do
tests("delete_cluster_parameter_group") do
present = !Fog::AWS[:redshift].describe_cluster_parameter_groups(:parameter_group_name=>parameter_group).body['ParameterGroups'].empty?
tests("verify presence before deletion").returns(true) { present }

View file

@ -1,12 +1,12 @@
Shindo.tests('Fog::Redshift[:aws] | cluster security group requests', ['aws']) do
pending if Fog.mocking?
suffix = rand(65536).to_s(16)
suffix = rand(65536).to_s(16)
identifier = "test-cluster-security-group-#{suffix}"
@cluster_security_group_format = {
"ClusterSecurityGroup" => {
"EC2SecurityGroups" => Fog::Nullable::Array,
"IPRanges" => Fog::Nullable::Array,
"EC2SecurityGroups" => Fog::Nullable::Array,
"IPRanges" => Fog::Nullable::Array,
"Description" => String,
"ClusterSecurityGroupName" => String
}
@ -27,7 +27,7 @@ Shindo.tests('Fog::Redshift[:aws] | cluster security group requests', ['aws']) d
body
end
tests("delete_cluster_security_group") do
tests("delete_cluster_security_group") do
present = !Fog::AWS[:redshift].describe_cluster_security_groups(:cluster_security_group_name => identifier).body['ClusterSecurityGroups'].empty?
tests("verify presence before deletion").returns(true) { present }

View file

@ -4,7 +4,7 @@ Shindo.tests('Fog::Redshift[:aws] | cluster snapshot requests', ['aws']) do
identifier = "test-snapshot-#{suffix}"
cluster = "test-cluster-#{suffix}"
start_time = Fog::Time.now.to_iso8601_basic
@cluster_snapshot_format = {
@cluster_snapshot_format = {
'Snapshot' => {
"AccountsWithRestoreAccess" => Fog::Nullable::Array,
"Port" => Integer,
@ -37,15 +37,15 @@ Shindo.tests('Fog::Redshift[:aws] | cluster snapshot requests', ['aws']) do
tests('success') do
tests("create_cluster_snapshot").formats(@cluster_snapshot_format) do
Fog::AWS[:redshift].create_cluster(:cluster_identifier => cluster,
:master_user_password => 'Pass1234',
:master_username => 'testuser',
:node_type => 'dw.hs1.xlarge',
Fog::AWS[:redshift].create_cluster(:cluster_identifier => cluster,
:master_user_password => 'Pass1234',
:master_username => 'testuser',
:node_type => 'dw.hs1.xlarge',
:cluster_type => 'single-node')
Fog.wait_for do
"available" == Fog::AWS[:redshift].describe_clusters(:cluster_identifier=>cluster).body['ClusterSet'].first['Cluster']['ClusterStatus']
end
body = Fog::AWS[:redshift].create_cluster_snapshot(:snapshot_identifier => identifier,
body = Fog::AWS[:redshift].create_cluster_snapshot(:snapshot_identifier => identifier,
:cluster_identifier => cluster).body
body
end
@ -56,16 +56,16 @@ Shindo.tests('Fog::Redshift[:aws] | cluster snapshot requests', ['aws']) do
body
end
tests('delete_cluster_snapshot').formats(@cluster_snapshot_format) do
tests('delete_cluster_snapshot').formats(@cluster_snapshot_format) do
Fog.wait_for do
"available" == Fog::AWS[:redshift].describe_cluster_snapshots(:snapshot_identifier=>identifier).body['Snapshots'].first['Snapshot']['Status']
"available" == Fog::AWS[:redshift].describe_cluster_snapshots(:snapshot_identifier=>identifier).body['Snapshots'].first['Snapshot']['Status']
end
sleep 30 unless Fog.mocking?
body = Fog::AWS[:redshift].delete_cluster_snapshot(:snapshot_identifier=>identifier).body
body = Fog::AWS[:redshift].delete_cluster_snapshot(:snapshot_identifier=>identifier).body
body
end
Fog::AWS[:redshift].delete_cluster(:cluster_identifier => cluster,
Fog::AWS[:redshift].delete_cluster(:cluster_identifier => cluster,
:skip_final_cluster_snapshot => true)
end

View file

@ -3,7 +3,7 @@ Shindo.tests('Fog::Redshift[:aws] | cluster requests', ['aws']) do
identifier = "test-cluster-#{rand(65536).to_s(16)}"
@cluster_format = {
'Cluster' => {
'Cluster' => {
"ClusterParameterGroups" => [{
"ClusterParameterGroup" => {
"ParameterApplyStatus" => String,
@ -17,7 +17,7 @@ Shindo.tests('Fog::Redshift[:aws] | cluster requests', ['aws']) do
}
}],
"VpcSecurityGroups" => Fog::Nullable::Array,
"EndPoint" => Fog::Nullable::Hash,
"EndPoint" => Fog::Nullable::Hash,
"PendingModifiedValues" => Fog::Nullable::Hash,
"RestoreStatus" => Fog::Nullable::Hash,
"ClusterVersion" => String,
@ -37,15 +37,15 @@ Shindo.tests('Fog::Redshift[:aws] | cluster requests', ['aws']) do
@describe_clusters_format = {
"ClusterSet" => [{
'Cluster' => @cluster_format['Cluster'].merge({"ClusterCreateTime"=>Time, "AvailabilityZone"=>String, "EndPoint"=>{"Port"=>Integer, "Address"=>String}})
}]
}]
}
tests('success') do
tests('create_cluster').formats(@cluster_format) do
body = Fog::AWS[:redshift].create_cluster(:cluster_identifier => identifier,
:master_user_password => 'Password1234',
body = Fog::AWS[:redshift].create_cluster(:cluster_identifier => identifier,
:master_user_password => 'Password1234',
:master_username => 'testuser',
:node_type => 'dw.hs1.xlarge',
:node_type => 'dw.hs1.xlarge',
:cluster_type => 'single-node').body
Fog.wait_for do
"available" == Fog::AWS[:redshift].describe_clusters(:cluster_identifier=>identifier).body['ClusterSet'].first['Cluster']['ClusterStatus']

View file

@ -54,7 +54,7 @@ Shindo.tests('Fog::Storage[:aws] | bucket requests', ["aws"]) do
tests("#put_bucket('#{@aws_bucket_name}') existing").succeeds do
Fog::Storage[:aws].put_bucket(@aws_bucket_name)
end
end
end
tests("#get_service").formats(@service_format) do
Fog::Storage[:aws].get_service.body

View file

@ -10,7 +10,7 @@ Shindo.tests('AWS::STS | assume role', ['aws']) do
'Arn' => String,
'RequestId' => String
}
tests("#assume_role('rolename', 'assumed_role_session', 'external_id', #{@policy.inspect}, 900)").formats(@response_format) do
pending if Fog.mocking?
Fog::AWS[:sts].assume_role("rolename","assumed_role_session","external_id", @policy, 900).body

View file

@ -16,5 +16,5 @@ Shindo.tests('AWS::STS | session tokens', ['aws']) do
tests("#get_federation_token('test@fog.io', #{@policy.inspect})").formats(@federation_format) do
Fog::AWS[:sts].get_federation_token("test@fog.io", @policy).body
end
end

View file

@ -12,5 +12,5 @@ Shindo.tests('AWS::STS | session tokens', ['aws']) do
pending if Fog.mocking?
Fog::AWS[:sts].get_session_token.body
end
end

View file

@ -18,7 +18,7 @@ Shindo.tests('AWS | signaturev4', ['aws']) do
'AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=0dc122f3b28b831ab48ba65cb47300de53fbe91b577fe113edac383730254a3b'
end
end
tests('get-vanilla-query-order-key') do
returns(@signer.sign({:query => {'a' => 'foo', 'b' => 'foo'}, :headers => {'Host' => 'host.foo.com', 'Date' => 'Mon, 09 Sep 2011 23:36:00 GMT'}, :method => :get, :path => '/'}, @now)) do
'AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=0dc122f3b28b831ab48ba65cb47300de53fbe91b577fe113edac383730254a3b'

View file

@ -2,7 +2,7 @@ require 'securerandom'
Shindo.tests('Bluebox::BLB | lb_tests', ['bluebox']) do
pending if Fog.mocking?
tests('success') do
@flavor_id = compute_providers[:bluebox][:server_attributes][:flavor_id]
@image_id = compute_providers[:bluebox][:server_attributes][:image_id]

View file

@ -6,7 +6,7 @@ class Bluebox
'description' => String,
'id' => String
},
LOCATION = {
'id' => String,
'description' => String

View file

@ -1,10 +1,10 @@
Shindo.tests('Fog::Compute[:bluebox] | location requests', ['bluebox']) do
@location_format = {
'id' => String,
'description' => String
}
tests('success') do
@location_id = compute_providers[:bluebox][:server_attributes][:location_id]

View file

@ -95,7 +95,7 @@ Shindo.tests('Fog::Compute[:clodo] | server requests', ['clodo']) do
# tests("- delete_ip_address(#{@server_id}, #{@additional_ip['ip']})").success do
# clodo.delete_ip_address(@server_id, @additional_ip['ip'])
# end
tests("- stop_server(#{@server_id})").succeeds do
clodo.stop_server(@server_id)
end

View file

@ -26,7 +26,7 @@ Shindo.tests('Fog::Compute[:cloudstack] | os type requests', ['cloudstack']) do
tests('#list_os_types').formats(@os_types_format) do
Fog::Compute[:cloudstack].list_os_types
end
tests('#list_os_categories').formats(@os_categories_format) do
pending if Fog.mocking?
Fog::Compute[:cloudstack].list_os_categories

View file

@ -28,7 +28,7 @@ Shindo.tests('Fog::Compute[:cloudstack] | template requests', ['cloudstack']) do
'isextractable' => Fog::Boolean,
'checksum' => Fog::Nullable::String,
'sourcetemplateid' => Fog::Nullable::Integer,
'accountid' => Fog::Nullable::Integer,
'accountid' => Fog::Nullable::Integer,
'bootable' => Fog::Nullable::Boolean,
'hostid' => Fog::Nullable::Integer,
'hostname' => Fog::Nullable::String,

View file

@ -62,7 +62,7 @@ Shindo.tests('Fog::Attributes', 'core') do
@model.merge_attributes(:bool => true)
@model.bool
end
tests(':bool => "false"').returns(false) do
@model.merge_attributes(:bool => 'false')
@model.bool
@ -77,7 +77,7 @@ Shindo.tests('Fog::Attributes', 'core') do
@model.merge_attributes(:bool => "foo")
@model.bool
end
end
end

View file

@ -71,5 +71,5 @@ Shindo.tests('Fog mocking', 'core') do
Fog::Mock.not_implemented
end
end

View file

@ -4,7 +4,7 @@ Shindo.tests('Fog#wait_for', 'core') do
Fog.wait_for(1) { true }
end
end
tests("failure") do
tests('Fog#wait_for').raises(Fog::Errors::TimeoutError) do
Fog.wait_for(2) { false }

View file

@ -14,7 +14,7 @@ Shindo.tests('Fog::Compute[:digitalocean] | create_ssh_key request', ['digitaloc
@key = Fog::Compute[:digitalocean].create_ssh_key 'fookey', 'fookey'
@key.body
end
end
service.destroy_ssh_key @key.body['ssh_key']['id']

View file

@ -8,7 +8,7 @@ Shindo.tests('Fog::Compute[:digitalocean] | destroy_ssh_key request', ['digitalo
key = service.create_ssh_key 'fookey', 'fookey'
service.destroy_ssh_key(key.body['ssh_key']['id']).body['status'] == 'OK'
end
end
tests('failures') do
@ -18,6 +18,6 @@ Shindo.tests('Fog::Compute[:digitalocean] | destroy_ssh_key request', ['digitalo
pending unless Fog.mocking?
service.destroy_ssh_key('00000000000').body['status'] == 'ERROR'
end
end
end
end

View file

@ -1,5 +1,5 @@
Shindo.tests('Fog::Compute[:digitalocean] | list_servers request', ['digitalocean', 'compute']) do
@server_format = {
'id' => Integer,
'name' => String,

View file

@ -13,8 +13,8 @@ Shindo.tests('Fog::Compute[:digitalocean] | power_cycle_server request', ['digit
server.state == 'off'
end
end
end
end

View file

@ -1,4 +1,4 @@
Shindo.tests('Fog::Compute[:digitalocean] | power on/off/shutdown requests',
Shindo.tests('Fog::Compute[:digitalocean] | power on/off/shutdown requests',
['digitalocean', 'compute']) do
service = Fog::Compute[:digitalocean]
@ -13,11 +13,11 @@ Shindo.tests('Fog::Compute[:digitalocean] | power on/off/shutdown requests',
test('#power_on_server') do
service.power_on_server(server.id).body['status'] == 'OK'
end
test('#shutdown_server') do
service.shutdown_server(server.id).body['status'] == 'OK'
end
server.start
end

View file

@ -7,8 +7,8 @@ Shindo.tests('Fog::Compute[:digitalocean] | reboot_server request', ['digitaloce
tests('#reboot_server').succeeds do
service.reboot_server(server.id).body['status'] == 'OK'
end
end
end

View file

@ -9,7 +9,7 @@ Shindo.tests('Fog::DNS[:dreamhost]', ['dreamhost', 'dns']) do
test("it should respond to #{collection}.get") { eval("service.#{collection}").respond_to? 'get' }
end
end
tests("requests") do
%w{ list_records create_record delete_record }.each do |request|
test("it should respond to #{request}") { service.respond_to? request }

View file

@ -2,7 +2,7 @@ def test_domain
'fog-dream.com'
end
def do_not_delete_record
def do_not_delete_record
"do-not-delete.#{test_domain}"
end

View file

@ -6,7 +6,7 @@ Shindo.tests("Fog::DNS[:dreamhost] | record", ['dreamhost', 'dns']) do
tests('#attributes') do
tests('should have') do
model_attribute_hash = record.attributes
attributes = [
attributes = [
:name,
:value,
:zone,
@ -33,9 +33,9 @@ Shindo.tests("Fog::DNS[:dreamhost] | record", ['dreamhost', 'dns']) do
:type => 'A',
:value => "8.8.8.8"
sleep 10
tests('#save') do
tests('#save') do
test('returns Fog::DNS::Dreamhost::Record') do
r.is_a? Fog::DNS::Dreamhost::Record
r.is_a? Fog::DNS::Dreamhost::Record
end
test('value is 8.8.8.8') do
r.value == '8.8.8.8'

View file

@ -1,14 +1,14 @@
Shindo.tests("Fog::DNS[:dreamhost] | records", ['dreamhost', 'dns']) do
service = Fog::DNS[:dreamhost]
tests('#all') do
records = service.records
test('should be an array') { records.is_a? Array }
test('should not be empty') { !records.empty? }
tests('should list Fog::DNS::Dreamhost::Record') do
records.each do |r|
test("as records") { r.is_a?(Fog::DNS::Dreamhost::Record) }

View file

@ -6,7 +6,7 @@ Shindo.tests("Fog::DNS[:dreamhost] | zone", ['dreamhost', 'dns']) do
tests('#attributes') do
tests('should have') do
model_attribute_hash = zone.attributes
attributes = [
attributes = [
:domain,
:id,
]
@ -24,7 +24,7 @@ Shindo.tests("Fog::DNS[:dreamhost] | zone", ['dreamhost', 'dns']) do
tests('Write operations') do
name = "#{test_domain}"
tests('#save') do
tests('#save') do
# Does not capture the exception for some reason
#raises(NotImplementedError, 'raises NotImplementedError') do
# service.zones.create :domain => name

View file

@ -1,14 +1,14 @@
Shindo.tests("Fog::DNS[:dreamhost] | Zones Collection", ['dreamhost', 'dns']) do
service = Fog::DNS[:dreamhost]
tests('#all') do
zones = service.zones
test('should be an array') { zones.is_a? Array }
test('should not be empty') { !zones.empty? }
tests('should list Fog::DNS::Dreamhost::Zone') do
zones.each do |r|
test("as zone") { r.is_a?(Fog::DNS::Dreamhost::Zone) }
@ -18,7 +18,7 @@ Shindo.tests("Fog::DNS[:dreamhost] | Zones Collection", ['dreamhost', 'dns']) do
tests('#get') do
tests('should fetch a zone') do
zone = service.zones.get test_domain
zone = service.zones.get test_domain
test('should be a Fog::DNS::Dreamhost::Zone') do
zone.is_a? Fog::DNS::Dreamhost::Zone
end

View file

@ -1,7 +1,7 @@
Shindo.tests('Fog::DNS[:dreamhost] | create_record request', ['dreamhost', 'dns']) do
tests("success") do
test("create an A resource record without comment") do
name = "foo.testing.#{test_domain}"
type = "A"
@ -10,14 +10,14 @@ Shindo.tests('Fog::DNS[:dreamhost] | create_record request', ['dreamhost', 'dns'
response.body['result'] == 'success'
end
test("create an A resource record with comment") do
name = "foo2.testing.#{test_domain}"
type = "A"
value = "1.2.3.4"
comment = "test"
response = Fog::DNS[:dreamhost].create_record(name, type, value, comment)
response.body['result'] == 'success'
end
@ -27,7 +27,7 @@ Shindo.tests('Fog::DNS[:dreamhost] | create_record request', ['dreamhost', 'dns'
value = "foobar"
comment = "test"
response = Fog::DNS[:dreamhost].create_record(name, type, value, comment)
response.body['result'] == 'success'
end

View file

@ -1,7 +1,7 @@
Shindo.tests('Fog::DNS[:dreamhost] | delete_record request', ['dreamhost', 'dns']) do
tests("success") do
test("delete testing records") do
name = "delete-test.#{test_domain}"
type = "A"

View file

@ -1,7 +1,7 @@
Shindo.tests('Fog::DNS[:dreamhost] | list_records request', ['dreamhost', 'dns']) do
tests("success") do
response = Fog::DNS[:dreamhost].list_records
test("should return 200") do
@ -22,7 +22,7 @@ Shindo.tests('Fog::DNS[:dreamhost] | list_records request', ['dreamhost', 'dns']
end
end
end
end
# helper

View file

@ -43,7 +43,7 @@ class Glesys
'version' => Fog::Nullable::Integer,
'ipaddress' => Fog::Nullable::String,
'currency' => String
}],
}],
'description' => String,
'hostname' => String,
'disksize' => Integer,

View file

@ -36,7 +36,7 @@ available_providers = Fog.available_providers.map {|provider| provider.downcase}
unavailable_providers = all_providers - available_providers
if !ENV['PROVIDER'].nil? && unavailable_providers.include?(ENV['PROVIDER'])
Formatador.display_line("[red]Requested provider #{ENV['PROVIDER']} is not available.[/]" +
Formatador.display_line("[red]Requested provider #{ENV['PROVIDER']} is not available.[/]" +
"[red]Check if .fog file has correct configuration (see '#{Fog.credentials_path}')[/]")
exit(0)
end

View file

@ -1,7 +1,7 @@
Shindo.tests("Fog::Compute::HPV2 | key_pair model", ['hp', 'v2', 'compute']) do
service = Fog::Compute.new(:provider => 'HP', :version => :v2)
model_tests(service.key_pairs, {:name => 'fogkeyname'}, true)
after do

View file

@ -56,7 +56,7 @@ Shindo.tests("Fog::Storage[:hp] | object requests", ['hp', 'storage']) do
Fog::Storage[:hp].delete_object(@dir_name, 'fog_object')
Fog::Storage[:hp].delete_object(@dir_name, 'fog_delete_object')
end
tests("#get_object_http_url('#{@directory.identity}', 'fog_object', expiration timestamp)").returns(true) do
object_url = Fog::Storage[:hp].get_object_http_url(@dir_name, 'fog_object', (Time.now + 60))
object_url.include? "fog_object"
@ -115,7 +115,7 @@ Shindo.tests("Fog::Storage[:hp] | object requests", ['hp', 'storage']) do
end
end
@directory.destroy
end

View file

@ -10,7 +10,7 @@ Shindo.tests('InternetArchive | url', ["internetarchive"]) do
:ia_secret_access_key => 'abc',
:region => 'us-east-1'
)
@file = @storage.directories.new(:key => 'fognonbucket').files.new(:key => 'test.txt')
if Fog.mock?

Some files were not shown because too many files have changed in this diff Show more