diff --git a/lib/fog/atmos/storage.rb b/lib/fog/atmos/storage.rb index 2a9713aa6..b00327e97 100644 --- a/lib/fog/atmos/storage.rb +++ b/lib/fog/atmos/storage.rb @@ -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 diff --git a/lib/fog/aws/beanstalk.rb b/lib/fog/aws/beanstalk.rb index 1f8e96b68..73c3559d5 100644 --- a/lib/fog/aws/beanstalk.rb +++ b/lib/fog/aws/beanstalk.rb @@ -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 diff --git a/lib/fog/aws/glacier.rb b/lib/fog/aws/glacier.rb index 6f74eb685..a435cd098 100644 --- a/lib/fog/aws/glacier.rb +++ b/lib/fog/aws/glacier.rb @@ -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 diff --git a/lib/fog/aws/models/auto_scaling/configuration.rb b/lib/fog/aws/models/auto_scaling/configuration.rb index c51ad6a69..09e8562a4 100644 --- a/lib/fog/aws/models/auto_scaling/configuration.rb +++ b/lib/fog/aws/models/auto_scaling/configuration.rb @@ -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) diff --git a/lib/fog/aws/models/cdn/distributions_helper.rb b/lib/fog/aws/models/cdn/distributions_helper.rb index 9c106a49b..7895df0f9 100644 --- a/lib/fog/aws/models/cdn/distributions_helper.rb +++ b/lib/fog/aws/models/cdn/distributions_helper.rb @@ -4,7 +4,7 @@ module Fog module CDN class AWS module DistributionsHelper - + def all(options = {}) merge_attributes(options) data = list_distributions(options).body diff --git a/lib/fog/aws/models/compute/route_table.rb b/lib/fog/aws/models/compute/route_table.rb index 151ec9cf3..0d48e14a0 100755 --- a/lib/fog/aws/models/compute/route_table.rb +++ b/lib/fog/aws/models/compute/route_table.rb @@ -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) diff --git a/lib/fog/aws/models/compute/server.rb b/lib/fog/aws/models/compute/server.rb index 28c37326b..23fcf6c19 100644 --- a/lib/fog/aws/models/compute/server.rb +++ b/lib/fog/aws/models/compute/server.rb @@ -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 diff --git a/lib/fog/aws/models/compute/servers.rb b/lib/fog/aws/models/compute/servers.rb index ae6926b55..54b95e073 100644 --- a/lib/fog/aws/models/compute/servers.rb +++ b/lib/fog/aws/models/compute/servers.rb @@ -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' && diff --git a/lib/fog/aws/models/iam/role.rb b/lib/fog/aws/models/iam/role.rb index 50317c8c2..458613e49 100644 --- a/lib/fog/aws/models/iam/role.rb +++ b/lib/fog/aws/models/iam/role.rb @@ -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 diff --git a/lib/fog/aws/models/storage/file.rb b/lib/fog/aws/models/storage/file.rb index 7ba1373c3..569196b26 100644 --- a/lib/fog/aws/models/storage/file.rb +++ b/lib/fog/aws/models/storage/file.rb @@ -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( diff --git a/lib/fog/aws/parsers/auto_scaling/put_notification_configuration.rb b/lib/fog/aws/parsers/auto_scaling/put_notification_configuration.rb index b63a1b309..eef6a956d 100644 --- a/lib/fog/aws/parsers/auto_scaling/put_notification_configuration.rb +++ b/lib/fog/aws/parsers/auto_scaling/put_notification_configuration.rb @@ -10,7 +10,7 @@ module Fog def start_element(name, attrs = []) super end - + def end_element(name) case name when 'RequestId' diff --git a/lib/fog/aws/parsers/cdn/streaming_distribution.rb b/lib/fog/aws/parsers/cdn/streaming_distribution.rb index 200b7588b..709d5a61e 100644 --- a/lib/fog/aws/parsers/cdn/streaming_distribution.rb +++ b/lib/fog/aws/parsers/cdn/streaming_distribution.rb @@ -2,7 +2,7 @@ module Fog module Parsers module CDN module AWS - + class StreamingDistribution < Fog::Parsers::Base def reset @response = { 'StreamingDistributionConfig' => { 'CNAME' => [], 'Logging' => {}, 'TrustedSigners' => [] } } diff --git a/lib/fog/aws/parsers/cloud_formation/describe_stacks.rb b/lib/fog/aws/parsers/cloud_formation/describe_stacks.rb index 79ec1b1ff..fe25cf524 100644 --- a/lib/fog/aws/parsers/cloud_formation/describe_stacks.rb +++ b/lib/fog/aws/parsers/cloud_formation/describe_stacks.rb @@ -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' diff --git a/lib/fog/aws/parsers/cloud_watch/describe_alarm_history.rb b/lib/fog/aws/parsers/cloud_watch/describe_alarm_history.rb index aae0f8a49..6d0329cf1 100644 --- a/lib/fog/aws/parsers/cloud_watch/describe_alarm_history.rb +++ b/lib/fog/aws/parsers/cloud_watch/describe_alarm_history.rb @@ -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' diff --git a/lib/fog/aws/parsers/cloud_watch/describe_alarms.rb b/lib/fog/aws/parsers/cloud_watch/describe_alarms.rb index 6276c2e76..36c703156 100644 --- a/lib/fog/aws/parsers/cloud_watch/describe_alarms.rb +++ b/lib/fog/aws/parsers/cloud_watch/describe_alarms.rb @@ -18,7 +18,7 @@ module Fog def start_element(name, attrs = []) super - case name + case name when 'Dimensions' @in_dimensions = true when 'member' diff --git a/lib/fog/aws/parsers/cloud_watch/describe_alarms_for_metric.rb b/lib/fog/aws/parsers/cloud_watch/describe_alarms_for_metric.rb index 1d882339c..3450b4a8e 100644 --- a/lib/fog/aws/parsers/cloud_watch/describe_alarms_for_metric.rb +++ b/lib/fog/aws/parsers/cloud_watch/describe_alarms_for_metric.rb @@ -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' diff --git a/lib/fog/aws/parsers/cloud_watch/disable_alarm_actions.rb b/lib/fog/aws/parsers/cloud_watch/disable_alarm_actions.rb index f6e4e96e9..d7c2d919f 100644 --- a/lib/fog/aws/parsers/cloud_watch/disable_alarm_actions.rb +++ b/lib/fog/aws/parsers/cloud_watch/disable_alarm_actions.rb @@ -17,7 +17,7 @@ module Fog @response['ResponseMetadata'][name] = value end end - end + end end end end diff --git a/lib/fog/aws/parsers/cloud_watch/enable_alarm_actions.rb b/lib/fog/aws/parsers/cloud_watch/enable_alarm_actions.rb index 979b9ca7f..a9049f115 100644 --- a/lib/fog/aws/parsers/cloud_watch/enable_alarm_actions.rb +++ b/lib/fog/aws/parsers/cloud_watch/enable_alarm_actions.rb @@ -17,7 +17,7 @@ module Fog @response['ResponseMetadata'][name] = value end end - end + end end end end diff --git a/lib/fog/aws/parsers/cloud_watch/set_alarm_state.rb b/lib/fog/aws/parsers/cloud_watch/set_alarm_state.rb index 648244496..ca308ec4b 100644 --- a/lib/fog/aws/parsers/cloud_watch/set_alarm_state.rb +++ b/lib/fog/aws/parsers/cloud_watch/set_alarm_state.rb @@ -17,7 +17,7 @@ module Fog @response['ResponseMetadata'][name] = value end end - end + end end end end diff --git a/lib/fog/aws/parsers/compute/create_dhcp_options.rb b/lib/fog/aws/parsers/compute/create_dhcp_options.rb index acd75c5af..4dadd93e3 100644 --- a/lib/fog/aws/parsers/compute/create_dhcp_options.rb +++ b/lib/fog/aws/parsers/compute/create_dhcp_options.rb @@ -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' diff --git a/lib/fog/aws/parsers/compute/describe_dhcp_options.rb b/lib/fog/aws/parsers/compute/describe_dhcp_options.rb index 1101ab0d2..061c04fb3 100644 --- a/lib/fog/aws/parsers/compute/describe_dhcp_options.rb +++ b/lib/fog/aws/parsers/compute/describe_dhcp_options.rb @@ -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' diff --git a/lib/fog/aws/parsers/compute/describe_instances.rb b/lib/fog/aws/parsers/compute/describe_instances.rb index 214aa74f5..9d770a56e 100644 --- a/lib/fog/aws/parsers/compute/describe_instances.rb +++ b/lib/fog/aws/parsers/compute/describe_instances.rb @@ -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' diff --git a/lib/fog/aws/parsers/compute/network_acl_parser.rb b/lib/fog/aws/parsers/compute/network_acl_parser.rb index a4e519a93..884354c8d 100644 --- a/lib/fog/aws/parsers/compute/network_acl_parser.rb +++ b/lib/fog/aws/parsers/compute/network_acl_parser.rb @@ -8,7 +8,7 @@ module Fog @association = {} @entry = { 'icmpTypeCode' => {}, 'portRange' => {} } @tag = {} - + @in_entry_set = false @in_association_set = false @in_tag_set = false diff --git a/lib/fog/aws/parsers/iam/get_group.rb b/lib/fog/aws/parsers/iam/get_group.rb index ad189d315..f6f6990ed 100644 --- a/lib/fog/aws/parsers/iam/get_group.rb +++ b/lib/fog/aws/parsers/iam/get_group.rb @@ -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 diff --git a/lib/fog/aws/rds.rb b/lib/fog/aws/rds.rb index 01985ffc4..7aed6384b 100644 --- a/lib/fog/aws/rds.rb +++ b/lib/fog/aws/rds.rb @@ -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' diff --git a/lib/fog/aws/requests/compute/associate_address.rb b/lib/fog/aws/requests/compute/associate_address.rb index 33e909fa7..ad6b7e147 100644 --- a/lib/fog/aws/requests/compute/associate_address.rb +++ b/lib/fog/aws/requests/compute/associate_address.rb @@ -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], diff --git a/lib/fog/google/examples/load-balance.rb b/lib/fog/google/examples/load-balance.rb index 8d1c43c9d..764658ac6 100644 --- a/lib/fog/google/examples/load-balance.rb +++ b/lib/fog/google/examples/load-balance.rb @@ -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. diff --git a/lib/fog/google/storage.rb b/lib/fog/google/storage.rb index efd3bd259..94cc7f0a0 100644 --- a/lib/fog/google/storage.rb +++ b/lib/fog/google/storage.rb @@ -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]}" diff --git a/lib/fog/openstack/models/compute/server.rb b/lib/fog/openstack/models/compute/server.rb index 968809a46..2fb9a3ba8 100644 --- a/lib/fog/openstack/models/compute/server.rb +++ b/lib/fog/openstack/models/compute/server.rb @@ -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 } diff --git a/lib/fog/rackspace/models/auto_scale/launch_config.rb b/lib/fog/rackspace/models/auto_scale/launch_config.rb index 2de801413..1275bd7cb 100644 --- a/lib/fog/rackspace/models/auto_scale/launch_config.rb +++ b/lib/fog/rackspace/models/auto_scale/launch_config.rb @@ -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 diff --git a/lib/fog/rackspace/models/compute_v2/server.rb b/lib/fog/rackspace/models/compute_v2/server.rb index c37a32c5a..7a7edf316 100644 --- a/lib/fog/rackspace/models/compute_v2/server.rb +++ b/lib/fog/rackspace/models/compute_v2/server.rb @@ -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) diff --git a/lib/fog/rackspace/models/monitoring/checks.rb b/lib/fog/rackspace/models/monitoring/checks.rb index 328b15091..1296db965 100644 --- a/lib/fog/rackspace/models/monitoring/checks.rb +++ b/lib/fog/rackspace/models/monitoring/checks.rb @@ -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 diff --git a/tests/aws/credentials_tests.rb b/tests/aws/credentials_tests.rb index 8be9aac19..54e08690b 100644 --- a/tests/aws/credentials_tests.rb +++ b/tests/aws/credentials_tests.rb @@ -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 diff --git a/tests/aws/models/auto_scaling/groups_test.rb b/tests/aws/models/auto_scaling/groups_test.rb index cf09f7a57..6cec9e7b6 100644 --- a/tests/aws/models/auto_scaling/groups_test.rb +++ b/tests/aws/models/auto_scaling/groups_test.rb @@ -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 diff --git a/tests/aws/models/cloud_watch/metric_statistics_tests.rb b/tests/aws/models/cloud_watch/metric_statistics_tests.rb index e5ebf4622..e84b24c44 100644 --- a/tests/aws/models/cloud_watch/metric_statistics_tests.rb +++ b/tests/aws/models/cloud_watch/metric_statistics_tests.rb @@ -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', diff --git a/tests/aws/models/cloud_watch/metrics_tests.rb b/tests/aws/models/cloud_watch/metrics_tests.rb index 59609eeed..4fc7b1e68 100644 --- a/tests/aws/models/cloud_watch/metrics_tests.rb +++ b/tests/aws/models/cloud_watch/metrics_tests.rb @@ -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 diff --git a/tests/aws/models/compute/network_acl_tests.rb b/tests/aws/models/compute/network_acl_tests.rb index a90d83ac0..209b12429 100644 --- a/tests/aws/models/compute/network_acl_tests.rb +++ b/tests/aws/models/compute/network_acl_tests.rb @@ -105,5 +105,5 @@ Shindo.tests("Fog::Compute[:aws] | network_acl", ['aws']) do end @subnet.destroy - @vpc.destroy + @vpc.destroy end diff --git a/tests/aws/models/compute/network_acls_tests.rb b/tests/aws/models/compute/network_acls_tests.rb index ffad2f5db..153e7bfda 100644 --- a/tests/aws/models/compute/network_acls_tests.rb +++ b/tests/aws/models/compute/network_acls_tests.rb @@ -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 diff --git a/tests/aws/models/compute/network_interfaces_test.rb b/tests/aws/models/compute/network_interfaces_test.rb index 3aef42190..6fdfa597f 100644 --- a/tests/aws/models/compute/network_interfaces_test.rb +++ b/tests/aws/models/compute/network_interfaces_test.rb @@ -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 diff --git a/tests/aws/models/compute/server_tests.rb b/tests/aws/models/compute/server_tests.rb index 1da42fc31..6ed018946 100644 --- a/tests/aws/models/compute/server_tests.rb +++ b/tests/aws/models/compute/server_tests.rb @@ -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 diff --git a/tests/aws/models/iam/access_keys_tests.rb b/tests/aws/models/iam/access_keys_tests.rb index e13973812..35fca76cf 100644 --- a/tests/aws/models/iam/access_keys_tests.rb +++ b/tests/aws/models/iam/access_keys_tests.rb @@ -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 diff --git a/tests/aws/models/iam/policies_tests.rb b/tests/aws/models/iam/policies_tests.rb index e43589e5c..a50eeda36 100644 --- a/tests/aws/models/iam/policies_tests.rb +++ b/tests/aws/models/iam/policies_tests.rb @@ -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 diff --git a/tests/aws/models/iam/roles_tests.rb b/tests/aws/models/iam/roles_tests.rb index ddad4a7b2..40da23edc 100644 --- a/tests/aws/models/iam/roles_tests.rb +++ b/tests/aws/models/iam/roles_tests.rb @@ -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 diff --git a/tests/aws/models/iam/users_tests.rb b/tests/aws/models/iam/users_tests.rb index 7864b434a..ea937c67d 100644 --- a/tests/aws/models/iam/users_tests.rb +++ b/tests/aws/models/iam/users_tests.rb @@ -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 diff --git a/tests/aws/models/storage/url_tests.rb b/tests/aws/models/storage/url_tests.rb index 8f4a1fc2f..9345b75c8 100644 --- a/tests/aws/models/storage/url_tests.rb +++ b/tests/aws/models/storage/url_tests.rb @@ -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? diff --git a/tests/aws/requests/cloud_watch/get_metric_statistics_tests.rb b/tests/aws/requests/cloud_watch/get_metric_statistics_tests.rb index 64b396db4..8379578cd 100644 --- a/tests/aws/requests/cloud_watch/get_metric_statistics_tests.rb +++ b/tests/aws/requests/cloud_watch/get_metric_statistics_tests.rb @@ -12,7 +12,7 @@ Shindo.tests('AWS::CloudWatch | metric requests', ['aws', 'cloudwatch']) do 'Average' => Float, 'Sum' => Float, 'SampleCount' => Float - }], + }], }, 'ResponseMetadata' => { 'RequestId' => String diff --git a/tests/aws/requests/compute/assign_private_ip_tests.rb b/tests/aws/requests/compute/assign_private_ip_tests.rb index 1c4378c91..0ad005ede 100644 --- a/tests/aws/requests/compute/assign_private_ip_tests.rb +++ b/tests/aws/requests/compute/assign_private_ip_tests.rb @@ -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 diff --git a/tests/aws/requests/compute/image_tests.rb b/tests/aws/requests/compute/image_tests.rb index 6630f732e..2ba422ce1 100644 --- a/tests/aws/requests/compute/image_tests.rb +++ b/tests/aws/requests/compute/image_tests.rb @@ -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 diff --git a/tests/aws/requests/compute/internet_gateway_tests.rb b/tests/aws/requests/compute/internet_gateway_tests.rb index 203a97486..be1c93e02 100644 --- a/tests/aws/requests/compute/internet_gateway_tests.rb +++ b/tests/aws/requests/compute/internet_gateway_tests.rb @@ -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 diff --git a/tests/aws/requests/compute/network_acl_tests.rb b/tests/aws/requests/compute/network_acl_tests.rb index 0b35a9374..a30a0669c 100644 --- a/tests/aws/requests/compute/network_acl_tests.rb +++ b/tests/aws/requests/compute/network_acl_tests.rb @@ -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 diff --git a/tests/aws/requests/compute/region_tests.rb b/tests/aws/requests/compute/region_tests.rb index 06813a1a4..d64934f83 100644 --- a/tests/aws/requests/compute/region_tests.rb +++ b/tests/aws/requests/compute/region_tests.rb @@ -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 diff --git a/tests/aws/requests/dynamodb/item_tests.rb b/tests/aws/requests/dynamodb/item_tests.rb index 29be359ea..7acf056d6 100644 --- a/tests/aws/requests/dynamodb/item_tests.rb +++ b/tests/aws/requests/dynamodb/item_tests.rb @@ -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' } diff --git a/tests/aws/requests/elasticache/helper.rb b/tests/aws/requests/elasticache/helper.rb index b5efa2284..6858f13ef 100644 --- a/tests/aws/requests/elasticache/helper.rb +++ b/tests/aws/requests/elasticache/helper.rb @@ -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 diff --git a/tests/aws/requests/elb/policy_tests.rb b/tests/aws/requests/elb/policy_tests.rb index 587bb1402..971c6fca0 100644 --- a/tests/aws/requests/elb/policy_tests.rb +++ b/tests/aws/requests/elb/policy_tests.rb @@ -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 diff --git a/tests/aws/requests/emr/helper.rb b/tests/aws/requests/emr/helper.rb index 1ce3e3d26..6d4cb761b 100644 --- a/tests/aws/requests/emr/helper.rb +++ b/tests/aws/requests/emr/helper.rb @@ -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, diff --git a/tests/aws/requests/glacier/multipart_upload_tests.rb b/tests/aws/requests/glacier/multipart_upload_tests.rb index 5cd14f43c..915d0f5ad 100644 --- a/tests/aws/requests/glacier/multipart_upload_tests.rb +++ b/tests/aws/requests/glacier/multipart_upload_tests.rb @@ -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 diff --git a/tests/aws/requests/iam/login_profile_tests.rb b/tests/aws/requests/iam/login_profile_tests.rb index f9ef40c93..7d1f37f23 100644 --- a/tests/aws/requests/iam/login_profile_tests.rb +++ b/tests/aws/requests/iam/login_profile_tests.rb @@ -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 diff --git a/tests/aws/requests/iam/role_tests.rb b/tests/aws/requests/iam/role_tests.rb index 3d78ddcbd..11e6eb5fd 100644 --- a/tests/aws/requests/iam/role_tests.rb +++ b/tests/aws/requests/iam/role_tests.rb @@ -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'] diff --git a/tests/aws/requests/rds/describe_events.rb b/tests/aws/requests/rds/describe_events.rb index 941b4df68..4a14e36f4 100644 --- a/tests/aws/requests/rds/describe_events.rb +++ b/tests/aws/requests/rds/describe_events.rb @@ -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 diff --git a/tests/aws/requests/rds/parameter_group_tests.rb b/tests/aws/requests/rds/parameter_group_tests.rb index 896e0f33a..0b120d802 100644 --- a/tests/aws/requests/rds/parameter_group_tests.rb +++ b/tests/aws/requests/rds/parameter_group_tests.rb @@ -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 diff --git a/tests/aws/requests/rds/parameter_request_tests.rb b/tests/aws/requests/rds/parameter_request_tests.rb index 5edfbda37..8c35082c2 100644 --- a/tests/aws/requests/rds/parameter_request_tests.rb +++ b/tests/aws/requests/rds/parameter_request_tests.rb @@ -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 diff --git a/tests/aws/requests/rds/security_group_tests.rb b/tests/aws/requests/rds/security_group_tests.rb index ec7882899..9e1b6e13a 100644 --- a/tests/aws/requests/rds/security_group_tests.rb +++ b/tests/aws/requests/rds/security_group_tests.rb @@ -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 diff --git a/tests/aws/requests/redshift/cluster_parameter_group_tests.rb b/tests/aws/requests/redshift/cluster_parameter_group_tests.rb index 977a40922..c7f43602f 100644 --- a/tests/aws/requests/redshift/cluster_parameter_group_tests.rb +++ b/tests/aws/requests/redshift/cluster_parameter_group_tests.rb @@ -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 } diff --git a/tests/aws/requests/redshift/cluster_security_group_tests.rb b/tests/aws/requests/redshift/cluster_security_group_tests.rb index 42d7c5569..698268369 100644 --- a/tests/aws/requests/redshift/cluster_security_group_tests.rb +++ b/tests/aws/requests/redshift/cluster_security_group_tests.rb @@ -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 } diff --git a/tests/aws/requests/redshift/cluster_snapshot_tests.rb b/tests/aws/requests/redshift/cluster_snapshot_tests.rb index de702e2d1..7365411fe 100644 --- a/tests/aws/requests/redshift/cluster_snapshot_tests.rb +++ b/tests/aws/requests/redshift/cluster_snapshot_tests.rb @@ -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 diff --git a/tests/aws/requests/redshift/cluster_tests.rb b/tests/aws/requests/redshift/cluster_tests.rb index cf13945a1..27d1ded7d 100644 --- a/tests/aws/requests/redshift/cluster_tests.rb +++ b/tests/aws/requests/redshift/cluster_tests.rb @@ -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'] diff --git a/tests/aws/requests/storage/bucket_tests.rb b/tests/aws/requests/storage/bucket_tests.rb index 21e97a0e9..20cbb1ddb 100644 --- a/tests/aws/requests/storage/bucket_tests.rb +++ b/tests/aws/requests/storage/bucket_tests.rb @@ -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 diff --git a/tests/aws/requests/sts/assume_role_tests.rb b/tests/aws/requests/sts/assume_role_tests.rb index 3b8fa3e51..cce659fcf 100644 --- a/tests/aws/requests/sts/assume_role_tests.rb +++ b/tests/aws/requests/sts/assume_role_tests.rb @@ -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 diff --git a/tests/aws/requests/sts/get_federation_token_tests.rb b/tests/aws/requests/sts/get_federation_token_tests.rb index 469569aa3..75673a23d 100644 --- a/tests/aws/requests/sts/get_federation_token_tests.rb +++ b/tests/aws/requests/sts/get_federation_token_tests.rb @@ -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 diff --git a/tests/aws/requests/sts/session_token_tests.rb b/tests/aws/requests/sts/session_token_tests.rb index ff52b8bb3..85a067840 100644 --- a/tests/aws/requests/sts/session_token_tests.rb +++ b/tests/aws/requests/sts/session_token_tests.rb @@ -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 diff --git a/tests/aws/signaturev4_tests.rb b/tests/aws/signaturev4_tests.rb index ca43eb14e..8734b4f14 100644 --- a/tests/aws/signaturev4_tests.rb +++ b/tests/aws/signaturev4_tests.rb @@ -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' diff --git a/tests/bluebox/requests/blb/lb_tests.rb b/tests/bluebox/requests/blb/lb_tests.rb index eabc28cde..473d2dcc6 100644 --- a/tests/bluebox/requests/blb/lb_tests.rb +++ b/tests/bluebox/requests/blb/lb_tests.rb @@ -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] diff --git a/tests/bluebox/requests/compute/helper.rb b/tests/bluebox/requests/compute/helper.rb index 452ca0461..7452f8a3a 100644 --- a/tests/bluebox/requests/compute/helper.rb +++ b/tests/bluebox/requests/compute/helper.rb @@ -6,7 +6,7 @@ class Bluebox 'description' => String, 'id' => String }, - + LOCATION = { 'id' => String, 'description' => String diff --git a/tests/bluebox/requests/compute/location_tests.rb b/tests/bluebox/requests/compute/location_tests.rb index 3d081281f..b64cf015a 100644 --- a/tests/bluebox/requests/compute/location_tests.rb +++ b/tests/bluebox/requests/compute/location_tests.rb @@ -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] diff --git a/tests/clodo/requests/compute/server_tests.rb b/tests/clodo/requests/compute/server_tests.rb index 814fc2233..cc04553ce 100644 --- a/tests/clodo/requests/compute/server_tests.rb +++ b/tests/clodo/requests/compute/server_tests.rb @@ -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 diff --git a/tests/cloudstack/requests/os_type_tests.rb b/tests/cloudstack/requests/os_type_tests.rb index 1346c5e46..e36533e8e 100644 --- a/tests/cloudstack/requests/os_type_tests.rb +++ b/tests/cloudstack/requests/os_type_tests.rb @@ -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 diff --git a/tests/cloudstack/requests/template_tests.rb b/tests/cloudstack/requests/template_tests.rb index ac78da9c0..4ce290439 100644 --- a/tests/cloudstack/requests/template_tests.rb +++ b/tests/cloudstack/requests/template_tests.rb @@ -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, diff --git a/tests/core/attribute_tests.rb b/tests/core/attribute_tests.rb index 63fd5e57a..7ec97bd14 100644 --- a/tests/core/attribute_tests.rb +++ b/tests/core/attribute_tests.rb @@ -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 diff --git a/tests/core/mocking_tests.rb b/tests/core/mocking_tests.rb index f9b53824f..19cb6858c 100644 --- a/tests/core/mocking_tests.rb +++ b/tests/core/mocking_tests.rb @@ -71,5 +71,5 @@ Shindo.tests('Fog mocking', 'core') do Fog::Mock.not_implemented end - + end diff --git a/tests/core/wait_for_tests.rb b/tests/core/wait_for_tests.rb index 1259b1c43..102f325e8 100644 --- a/tests/core/wait_for_tests.rb +++ b/tests/core/wait_for_tests.rb @@ -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 } diff --git a/tests/digitalocean/requests/compute/create_ssh_key_tests.rb b/tests/digitalocean/requests/compute/create_ssh_key_tests.rb index 74a098fd5..f92aec112 100644 --- a/tests/digitalocean/requests/compute/create_ssh_key_tests.rb +++ b/tests/digitalocean/requests/compute/create_ssh_key_tests.rb @@ -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'] diff --git a/tests/digitalocean/requests/compute/destroy_ssh_key_tests.rb b/tests/digitalocean/requests/compute/destroy_ssh_key_tests.rb index 7e0388a77..7084a423f 100644 --- a/tests/digitalocean/requests/compute/destroy_ssh_key_tests.rb +++ b/tests/digitalocean/requests/compute/destroy_ssh_key_tests.rb @@ -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 diff --git a/tests/digitalocean/requests/compute/list_servers_tests.rb b/tests/digitalocean/requests/compute/list_servers_tests.rb index 9e520ff01..4e847a288 100644 --- a/tests/digitalocean/requests/compute/list_servers_tests.rb +++ b/tests/digitalocean/requests/compute/list_servers_tests.rb @@ -1,5 +1,5 @@ Shindo.tests('Fog::Compute[:digitalocean] | list_servers request', ['digitalocean', 'compute']) do - + @server_format = { 'id' => Integer, 'name' => String, diff --git a/tests/digitalocean/requests/compute/power_cycle_server_tests.rb b/tests/digitalocean/requests/compute/power_cycle_server_tests.rb index e393be2bc..93a2e2d7e 100644 --- a/tests/digitalocean/requests/compute/power_cycle_server_tests.rb +++ b/tests/digitalocean/requests/compute/power_cycle_server_tests.rb @@ -13,8 +13,8 @@ Shindo.tests('Fog::Compute[:digitalocean] | power_cycle_server request', ['digit server.state == 'off' end end - + end - + end diff --git a/tests/digitalocean/requests/compute/power_state_tests.rb b/tests/digitalocean/requests/compute/power_state_tests.rb index c8555b0ff..aec88c61e 100644 --- a/tests/digitalocean/requests/compute/power_state_tests.rb +++ b/tests/digitalocean/requests/compute/power_state_tests.rb @@ -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 diff --git a/tests/digitalocean/requests/compute/reboot_server_tests.rb b/tests/digitalocean/requests/compute/reboot_server_tests.rb index 6b8ec76a8..1de4f68b5 100644 --- a/tests/digitalocean/requests/compute/reboot_server_tests.rb +++ b/tests/digitalocean/requests/compute/reboot_server_tests.rb @@ -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 diff --git a/tests/dreamhost/dns_tests.rb b/tests/dreamhost/dns_tests.rb index 7afa73375..ac5c63c58 100644 --- a/tests/dreamhost/dns_tests.rb +++ b/tests/dreamhost/dns_tests.rb @@ -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 } diff --git a/tests/dreamhost/helper.rb b/tests/dreamhost/helper.rb index d47fc08bd..e22213ee5 100644 --- a/tests/dreamhost/helper.rb +++ b/tests/dreamhost/helper.rb @@ -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 diff --git a/tests/dreamhost/models/dns/record_tests.rb b/tests/dreamhost/models/dns/record_tests.rb index 45062d46a..80de636e0 100644 --- a/tests/dreamhost/models/dns/record_tests.rb +++ b/tests/dreamhost/models/dns/record_tests.rb @@ -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' diff --git a/tests/dreamhost/models/dns/records_tests.rb b/tests/dreamhost/models/dns/records_tests.rb index ab492d76e..af82b3068 100644 --- a/tests/dreamhost/models/dns/records_tests.rb +++ b/tests/dreamhost/models/dns/records_tests.rb @@ -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) } diff --git a/tests/dreamhost/models/dns/zone_tests.rb b/tests/dreamhost/models/dns/zone_tests.rb index 2c46f3ec1..2ec3ba269 100644 --- a/tests/dreamhost/models/dns/zone_tests.rb +++ b/tests/dreamhost/models/dns/zone_tests.rb @@ -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 diff --git a/tests/dreamhost/models/dns/zones_tests.rb b/tests/dreamhost/models/dns/zones_tests.rb index caee3448a..ee525b464 100644 --- a/tests/dreamhost/models/dns/zones_tests.rb +++ b/tests/dreamhost/models/dns/zones_tests.rb @@ -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 diff --git a/tests/dreamhost/requests/dns/create_record_tests.rb b/tests/dreamhost/requests/dns/create_record_tests.rb index ab15f25bd..b97d15117 100644 --- a/tests/dreamhost/requests/dns/create_record_tests.rb +++ b/tests/dreamhost/requests/dns/create_record_tests.rb @@ -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 diff --git a/tests/dreamhost/requests/dns/delete_record_tests.rb b/tests/dreamhost/requests/dns/delete_record_tests.rb index 0f8b82afa..2b216a8cd 100644 --- a/tests/dreamhost/requests/dns/delete_record_tests.rb +++ b/tests/dreamhost/requests/dns/delete_record_tests.rb @@ -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" diff --git a/tests/dreamhost/requests/dns/list_records_tests.rb b/tests/dreamhost/requests/dns/list_records_tests.rb index 0c48270d8..32025cb03 100644 --- a/tests/dreamhost/requests/dns/list_records_tests.rb +++ b/tests/dreamhost/requests/dns/list_records_tests.rb @@ -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 diff --git a/tests/glesys/requests/compute/helper.rb b/tests/glesys/requests/compute/helper.rb index 1382e7136..cbce9cfe4 100644 --- a/tests/glesys/requests/compute/helper.rb +++ b/tests/glesys/requests/compute/helper.rb @@ -43,7 +43,7 @@ class Glesys 'version' => Fog::Nullable::Integer, 'ipaddress' => Fog::Nullable::String, 'currency' => String - }], + }], 'description' => String, 'hostname' => String, 'disksize' => Integer, diff --git a/tests/helper.rb b/tests/helper.rb index 69b91a80e..edc0250d6 100644 --- a/tests/helper.rb +++ b/tests/helper.rb @@ -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 diff --git a/tests/hp/models/compute_v2/key_pair_tests.rb b/tests/hp/models/compute_v2/key_pair_tests.rb index 95e9f89ab..7551b8f22 100644 --- a/tests/hp/models/compute_v2/key_pair_tests.rb +++ b/tests/hp/models/compute_v2/key_pair_tests.rb @@ -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 diff --git a/tests/hp/requests/storage/object_tests.rb b/tests/hp/requests/storage/object_tests.rb index 389854c7c..70c3f4eb5 100644 --- a/tests/hp/requests/storage/object_tests.rb +++ b/tests/hp/requests/storage/object_tests.rb @@ -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 diff --git a/tests/internet_archive/models/storage/url_tests.rb b/tests/internet_archive/models/storage/url_tests.rb index 798c5e25d..e5df5d08b 100644 --- a/tests/internet_archive/models/storage/url_tests.rb +++ b/tests/internet_archive/models/storage/url_tests.rb @@ -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? diff --git a/tests/internet_archive/requests/storage/bucket_tests.rb b/tests/internet_archive/requests/storage/bucket_tests.rb index a7a36213e..a0e9db7ee 100644 --- a/tests/internet_archive/requests/storage/bucket_tests.rb +++ b/tests/internet_archive/requests/storage/bucket_tests.rb @@ -23,14 +23,14 @@ Shindo.tests('Fog::Storage[:internetarchive] | bucket requests', ["internetarchi } @bucket_lifecycle_format = { 'Rules' => [{ - 'ID' => String, + 'ID' => String, 'Prefix' => Fog::Nullable::String, - 'Enabled' => Fog::Boolean, + 'Enabled' => Fog::Boolean, 'Expiration' => Fog::Nullable::Hash, 'Transition' => Fog::Nullable::Hash }] } - + @service_format = { 'Buckets' => [{ 'CreationDate' => Time, diff --git a/tests/internet_archive/signaturev4_tests.rb b/tests/internet_archive/signaturev4_tests.rb index 9532a492a..dc1eaec3f 100644 --- a/tests/internet_archive/signaturev4_tests.rb +++ b/tests/internet_archive/signaturev4_tests.rb @@ -18,7 +18,7 @@ Shindo.tests('InternetArchive | signaturev4', ['internetarchive']) 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 => '/'}, Fog::Time.now)) do 'AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=0dc122f3b28b831ab48ba65cb47300de53fbe91b577fe113edac383730254a3b' diff --git a/tests/linode/requests/compute/datacenter_tests.rb b/tests/linode/requests/compute/datacenter_tests.rb index 3fb797147..3e70e5720 100644 --- a/tests/linode/requests/compute/datacenter_tests.rb +++ b/tests/linode/requests/compute/datacenter_tests.rb @@ -1,7 +1,7 @@ Shindo.tests('Fog::Compute[:linode] | datacenter requests', ['linode']) do @datacenters_format = Linode::Compute::Formats::BASIC.merge({ - 'DATA' => [{ + 'DATA' => [{ 'DATACENTERID' => Integer, 'LOCATION' => String }] diff --git a/tests/linode/requests/compute/distribution_tests.rb b/tests/linode/requests/compute/distribution_tests.rb index 97c8bb482..682469b1c 100644 --- a/tests/linode/requests/compute/distribution_tests.rb +++ b/tests/linode/requests/compute/distribution_tests.rb @@ -1,7 +1,7 @@ Shindo.tests('Fog::Compute[:linode] | distribution requests', ['linode']) do @distributions_format = Linode::Compute::Formats::BASIC.merge({ - 'DATA' => [{ + 'DATA' => [{ 'CREATE_DT' => String, 'DISTRIBUTIONID' => Integer, 'IS64BIT' => Integer, diff --git a/tests/linode/requests/compute/kernel_tests.rb b/tests/linode/requests/compute/kernel_tests.rb index fe5c04184..42886a6bf 100644 --- a/tests/linode/requests/compute/kernel_tests.rb +++ b/tests/linode/requests/compute/kernel_tests.rb @@ -1,7 +1,7 @@ Shindo.tests('Fog::Compute[:linode] | kernel requests', ['linode']) do @kernels_format = Linode::Compute::Formats::BASIC.merge({ - 'DATA' => [{ + 'DATA' => [{ 'LABEL' => String, 'ISXEN' => Integer, 'ISPVOPS' => Integer, diff --git a/tests/linode/requests/compute/linode_tests.rb b/tests/linode/requests/compute/linode_tests.rb index 514171436..c1c49bc59 100644 --- a/tests/linode/requests/compute/linode_tests.rb +++ b/tests/linode/requests/compute/linode_tests.rb @@ -55,7 +55,7 @@ Shindo.tests('Fog::Compute[:linode] | linode requests', ['linode']) do @disk_format = Linode::Compute::Formats::BASIC.merge({ 'DATA' => { 'JobID' => Integer, 'DiskID' => Integer } - }) + }) tests('success') do @@ -75,7 +75,7 @@ Shindo.tests('Fog::Compute[:linode] | linode requests', ['linode']) do end tests('#linode_list').formats(@linodes_format) do - pending if Fog.mocking? + pending if Fog.mocking? Fog::Compute[:linode].linode_list.body end @@ -94,7 +94,7 @@ Shindo.tests('Fog::Compute[:linode] | linode requests', ['linode']) do data = Fog::Compute[:linode].linode_disk_create(@linode_id, 'test1', 'ext3', 1).body @disk1_id = data['DATA']['DiskID'] data - end + end tests('#linode_disk_createfromdistribution').formats(@disk_format) do pending if Fog.mocking? @@ -110,7 +110,7 @@ Shindo.tests('Fog::Compute[:linode] | linode requests', ['linode']) do # tests("#linode_reboot(#{@linode_id})").formats(@reboot_format) do # Fog::Compute[:linode].linode_reboot(@linode_id).body - # end + # end tests('#linode_disk_delete').formats(@disk_format) do pending if Fog.mocking? diff --git a/tests/linode/requests/compute/linodeplans_tests.rb b/tests/linode/requests/compute/linodeplans_tests.rb index f656b3659..a685255da 100644 --- a/tests/linode/requests/compute/linodeplans_tests.rb +++ b/tests/linode/requests/compute/linodeplans_tests.rb @@ -1,7 +1,7 @@ Shindo.tests('Fog::Compute[:linode] | linodeplans requests', ['linode']) do @linodeplans_format = Linode::Compute::Formats::BASIC.merge({ - 'DATA' => [{ + 'DATA' => [{ 'AVAIL' => { '2' => Integer, '3' => Integer, diff --git a/tests/linode/requests/compute/stackscripts_tests.rb b/tests/linode/requests/compute/stackscripts_tests.rb index a877afa5d..ed74320e2 100644 --- a/tests/linode/requests/compute/stackscripts_tests.rb +++ b/tests/linode/requests/compute/stackscripts_tests.rb @@ -1,7 +1,7 @@ Shindo.tests('Fog::Compute[:linode] | stack_script requests', ['linode']) do @stack_scripts_format = Linode::Compute::Formats::BASIC.merge({ - 'DATA' => [{ + 'DATA' => [{ 'STACKSCRIPTID' => Integer, 'SCRIPT' => String, 'DESCRIPTION' => String, @@ -16,15 +16,15 @@ Shindo.tests('Fog::Compute[:linode] | stack_script requests', ['linode']) do 'ISPUBLIC' => Integer, 'USERID' => Integer }] - }) + }) tests('success') do tests('#avail_stackscripts').formats(@stack_scripts_format) do pending if Fog.mocking? Fog::Compute[:linode].avail_stackscripts.body - end - + end + tests('#stackscript_list').formats(@stack_scripts_format) do pending # TODO: REV_NOTE can be either string or float? pending if Fog.mocking? diff --git a/tests/linode/requests/dns/dns_tests.rb b/tests/linode/requests/dns/dns_tests.rb index a0f6e1e56..482ef7c83 100644 --- a/tests/linode/requests/dns/dns_tests.rb +++ b/tests/linode/requests/dns/dns_tests.rb @@ -15,7 +15,7 @@ Shindo.tests('Fog::DNS[:linode] | DNS requests', ['linode', 'dns']) do zones = response.body['DATA'] @org_zone_count = zones.count end - + response.status == 200 end @@ -30,7 +30,7 @@ Shindo.tests('Fog::DNS[:linode] | DNS requests', ['linode', 'dns']) do @master_zone_id = response.body['DATA']['DomainID'] @new_zones << @master_zone_id end - + response.status == 200 end @@ -39,14 +39,14 @@ Shindo.tests('Fog::DNS[:linode] | DNS requests', ['linode', 'dns']) do type = 'slave' @domain= generate_unique_domain - options = { :SOA_email => "netops@#{@domain}", :refresh_sec => 14400, :retry_sec => 3600, + options = { :SOA_email => "netops@#{@domain}", :refresh_sec => 14400, :retry_sec => 3600, :expire_sec => 604800, :ttl_sec => 28800, :status => 0, :master_ips => '1.2.3.4;2.3.4.5' } response = Fog::DNS[:linode].domain_create( @domain, type, options) if response.status == 200 @slave_zone_id = response.body['DATA']['DomainID'] @new_zones << @slave_zone_id end - + response.status == 200 end @@ -54,7 +54,7 @@ Shindo.tests('Fog::DNS[:linode] | DNS requests', ['linode', 'dns']) do pending if Fog.mocking? result= false - + response = Fog::DNS[:linode].domain_list( @slave_zone_id) if response.status == 200 zones = response.body['DATA'] @@ -63,13 +63,13 @@ Shindo.tests('Fog::DNS[:linode] | DNS requests', ['linode', 'dns']) do zone= zones[0] if (zone['SOA_EMAIL'] == "netops@#{@domain}") and (zone['REFRESH_SEC'] == 14400) and (zone['RETRY_SEC'] == 3600) and (zone['EXPIRE_SEC'] == 604800) and (zone['TTL_SEC'] == 28800) and - (zone['STATUS'] == 0) and (zone['DOMAIN'] == @domain) and (zone['TYPE'] == 'slave') + (zone['STATUS'] == 0) and (zone['DOMAIN'] == @domain) and (zone['TYPE'] == 'slave') (zone['MASTER_IPS'] == '1.2.3.4;2.3.4.5') result= true - end + end end end - + result end @@ -77,13 +77,13 @@ Shindo.tests('Fog::DNS[:linode] | DNS requests', ['linode', 'dns']) do pending if Fog.mocking? result= false - + options = { :ttl_sec => 14400 } response = Fog::DNS[:linode].domain_update( @slave_zone_id, options) if response.status == 200 result= true end - + result end @@ -91,7 +91,7 @@ Shindo.tests('Fog::DNS[:linode] | DNS requests', ['linode', 'dns']) do pending if Fog.mocking? result= false - + response = Fog::DNS[:linode].domain_list( @slave_zone_id) if response.status == 200 zones = response.body['DATA'] @@ -100,10 +100,10 @@ Shindo.tests('Fog::DNS[:linode] | DNS requests', ['linode', 'dns']) do zone= zones[0] if (zone['TTL_SEC'] == 14400) result= true - end + end end end - + result end @@ -117,7 +117,7 @@ Shindo.tests('Fog::DNS[:linode] | DNS requests', ['linode', 'dns']) do record_id = response.body['DATA']['ResourceID'] @new_records << record_id end - + response.status == 200 end @@ -131,7 +131,7 @@ Shindo.tests('Fog::DNS[:linode] | DNS requests', ['linode', 'dns']) do record_id = response.body['DATA']['ResourceID'] @new_records << record_id end - + response.status == 200 end @@ -144,7 +144,7 @@ Shindo.tests('Fog::DNS[:linode] | DNS requests', ['linode', 'dns']) do record_id = response.body['DATA']['ResourceID'] @new_records << record_id end - + response.status == 200 end @@ -157,7 +157,7 @@ Shindo.tests('Fog::DNS[:linode] | DNS requests', ['linode', 'dns']) do @record_id = response.body['DATA']['ResourceID'] @new_records << @record_id end - + response.status == 200 end @@ -165,7 +165,7 @@ Shindo.tests('Fog::DNS[:linode] | DNS requests', ['linode', 'dns']) do pending if Fog.mocking? result= false - + domain= 'mail.' + @domain response = Fog::DNS[:linode].domain_resource_list(@master_zone_id, @record_id) if response.status == 200 @@ -178,13 +178,13 @@ Shindo.tests('Fog::DNS[:linode] | DNS requests', ['linode', 'dns']) do result= true end end - + end - + result end - test("update record #{@record_id} - change target") do + test("update record #{@record_id} - change target") do pending if Fog.mocking? options = { :target => 'mail2.' + @domain } @@ -197,7 +197,7 @@ Shindo.tests('Fog::DNS[:linode] | DNS requests', ['linode', 'dns']) do pending if Fog.mocking? result= false - + domain= 'mail2.' + @domain response = Fog::DNS[:linode].domain_resource_list(@master_zone_id, @record_id) if response.status == 200 @@ -209,13 +209,13 @@ Shindo.tests('Fog::DNS[:linode] | DNS requests', ['linode', 'dns']) do result= true end end - + end - + result end - + test("delete #{@new_records.count} records created") do pending if Fog.mocking? @@ -243,8 +243,8 @@ Shindo.tests('Fog::DNS[:linode] | DNS requests', ['linode', 'dns']) do end end - + tests( 'failure') do end - + end diff --git a/tests/openstack/authenticate_tests.rb b/tests/openstack/authenticate_tests.rb index d1c5327b3..ed47b6b92 100644 --- a/tests/openstack/authenticate_tests.rb +++ b/tests/openstack/authenticate_tests.rb @@ -104,7 +104,7 @@ Shindo.tests('OpenStack | authenticate', ['openstack']) do tests("v2 auth with two compute services") do body_clone = body.clone - body_clone["access"]["serviceCatalog"] << + body_clone["access"]["serviceCatalog"] << { "endpoints" => [{ "adminURL" => diff --git a/tests/openstack/models/compute/server_tests.rb b/tests/openstack/models/compute/server_tests.rb index 6d66cc536..50daf9cc7 100644 --- a/tests/openstack/models/compute/server_tests.rb +++ b/tests/openstack/models/compute/server_tests.rb @@ -63,11 +63,11 @@ Shindo.tests("Fog::Compute[:openstack] | server", ['openstack']) do end tests('#failed') do - + fog = Fog::Compute[:openstack] flavor = fog.flavors.first.id - image = fog.images.first.id + image = fog.images.first.id tests('successful server').returns(false) do server = fog.servers.new( :name => 'test server', diff --git a/tests/openstack/models/image/images_tests.rb b/tests/openstack/models/image/images_tests.rb index 2d893c872..18f6a7ad0 100644 --- a/tests/openstack/models/image/images_tests.rb +++ b/tests/openstack/models/image/images_tests.rb @@ -11,7 +11,7 @@ Shindo.tests("Fog::Image[:openstack] | images", ['openstack']) do image = Fog::Image[:openstack].images.get(@instance['image']['id']) image.id == @instance['image']['id'] end - + tests('#destroy').succeeds do Fog::Image[:openstack].images.destroy(@instance['image']['id']) end diff --git a/tests/openstack/models/network/network_tests.rb b/tests/openstack/models/network/network_tests.rb index 4dca50d2a..5091b0412 100644 --- a/tests/openstack/models/network/network_tests.rb +++ b/tests/openstack/models/network/network_tests.rb @@ -1,7 +1,7 @@ Shindo.tests("Fog::Network[:openstack] | network", ['openstack']) do tests('success') do - + tests('#create').succeeds do @instance = Fog::Network[:openstack].networks.create(:name => 'net_name', :shared => false, @@ -9,7 +9,7 @@ Shindo.tests("Fog::Network[:openstack] | network", ['openstack']) do :tenant_id => 'tenant_id') !@instance.id.nil? end - + tests('#create+extensions').succeeds do net = Fog::Network[:openstack].networks.create( :name => 'net_name', @@ -26,9 +26,9 @@ Shindo.tests("Fog::Network[:openstack] | network", ['openstack']) do net.destroy net.provider_network_type == 'gre' end - + tests('have attributes') do - attributes = [ + attributes = [ :name, :subnets, :shared, diff --git a/tests/openstack/models/storage/file_tests.rb b/tests/openstack/models/storage/file_tests.rb index eaa271fa4..b4b9361e1 100644 --- a/tests/openstack/models/storage/file_tests.rb +++ b/tests/openstack/models/storage/file_tests.rb @@ -47,7 +47,7 @@ Shindo.tests('Fog::OpenStack::Storage | file', ['openstack']) do tests('#metadata') do before do - @instance.metadata[:foo] = 'bar' + @instance.metadata[:foo] = 'bar' @instance.save end @@ -88,38 +88,38 @@ Shindo.tests('Fog::OpenStack::Storage | file', ['openstack']) do end tests('#metadata keys') do - + after do clear_metadata @instance.save end - @instance.metadata[:foo_bar] = 'baz' + @instance.metadata[:foo_bar] = 'baz' tests("should support compound key names").returns('baz') do @instance.save object_meta_attributes['X-Object-Meta-Foo-Bar'] end - @instance.metadata['foo'] = 'bar' + @instance.metadata['foo'] = 'bar' tests("should support string keys").returns('bar') do @instance.save object_meta_attributes['X-Object-Meta-Foo'] end - @instance.metadata['foo_bar'] = 'baz' + @instance.metadata['foo_bar'] = 'baz' tests("should support compound string key names").returns('baz') do @instance.save object_meta_attributes['X-Object-Meta-Foo-Bar'] end - @instance.metadata['foo-bar'] = 'baz' + @instance.metadata['foo-bar'] = 'baz' tests("should support hyphenated keys").returns('baz') do @instance.save object_meta_attributes['X-Object-Meta-Foo-Bar'] end - @instance.metadata['foo-bar'] = 'baz' - @instance.metadata[:'foo_bar'] = 'bref' + @instance.metadata['foo-bar'] = 'baz' + @instance.metadata[:'foo_bar'] = 'bref' tests("should only support one value per metadata key").returns('bref') do @instance.save object_meta_attributes['X-Object-Meta-Foo-Bar'] @@ -136,22 +136,22 @@ Shindo.tests('Fog::OpenStack::Storage | file', ['openstack']) do end @instance.access_control_allow_origin = 'http://example.com' - @instance.save + @instance.save tests("#access_control_allow_origin should return access control attribute").returns('http://example.com') do @instance.access_control_allow_origin end @instance.access_control_allow_origin = 'foo' - @instance.save + @instance.save tests("#access_control_allow_origin= should update access_control_allow_origin").returns('bar') do @instance.access_control_allow_origin = 'bar' - @instance.save + @instance.save @instance.access_control_allow_origin end tests("#access_control_allow_origin= should not blow up on nil") do @instance.access_control_allow_origin = nil - @instance.save + @instance.save end end @@ -163,7 +163,7 @@ Shindo.tests('Fog::OpenStack::Storage | file', ['openstack']) do tests("#origin") do tests("#origin should default to nil").returns(nil) do - @instance.save + @instance.save @instance.origin end @@ -175,7 +175,7 @@ Shindo.tests('Fog::OpenStack::Storage | file', ['openstack']) do @instance.attributes.delete('Origin') @instance.origin = 'foo' - @instance.save + @instance.save tests("#origin= should update origin").returns('bar') do @instance.origin = 'bar' @instance.save @@ -184,7 +184,7 @@ Shindo.tests('Fog::OpenStack::Storage | file', ['openstack']) do tests("#origin= should not blow up on nil") do @instance.origin = nil - @instance.save + @instance.save end end diff --git a/tests/openstack/requests/compute/address_tests.rb b/tests/openstack/requests/compute/address_tests.rb index 3d02404a2..1d94f7b22 100644 --- a/tests/openstack/requests/compute/address_tests.rb +++ b/tests/openstack/requests/compute/address_tests.rb @@ -15,7 +15,7 @@ Shindo.tests('Fog::Compute[:openstack] | address requests', ['openstack']) do @address_pools_format = { "name" => String } - + tests('success') do tests('#allocate_address').formats({"floating_ip" => @address_format}) do @@ -36,7 +36,7 @@ Shindo.tests('Fog::Compute[:openstack] | address requests', ['openstack']) do tests('#list_address_pools').formats({"floating_ip_pools" => [@address_pools_format]}) do compute.list_address_pools.body end - + compute.servers.get(@server_id).wait_for { ready? } tests('#associate_address(server_id, ip_address)').succeeds do diff --git a/tests/openstack/requests/compute/server_tests.rb b/tests/openstack/requests/compute/server_tests.rb index 2875c6ca5..04f5b551c 100644 --- a/tests/openstack/requests/compute/server_tests.rb +++ b/tests/openstack/requests/compute/server_tests.rb @@ -25,7 +25,7 @@ Shindo.tests('Fog::Compute[:openstack] | server requests', ['openstack']) do 'links' => Array, 'security_groups' => Fog::Nullable::Array, } - + @reservation_format = { 'reservation_id' => String, } @@ -70,7 +70,7 @@ Shindo.tests('Fog::Compute[:openstack] | server requests', ['openstack']) do @reservation_id = data['reservation_id'] data end - + tests('#validate_multi_create') do passed = false @multi_create_servers = [] @@ -88,7 +88,7 @@ Shindo.tests('Fog::Compute[:openstack] | server requests', ['openstack']) do Fog::Compute[:openstack].servers.get(server).destroy } end - + #LIST #NOTE: we can remove strict=false if we remove uuid from GET /servers tests('#list_servers').formats({'servers' => [OpenStack::Compute::Formats::SUMMARY]}, false) do @@ -101,7 +101,7 @@ Shindo.tests('Fog::Compute[:openstack] | server requests', ['openstack']) do end #CHANGE PASSWORD - if set_password_enabled + if set_password_enabled tests("#change_server_password(#{@server_id}, 'fogupdatedserver')").succeeds do Fog::Compute[:openstack].change_server_password(@server_id, 'foggy') end @@ -113,7 +113,7 @@ Shindo.tests('Fog::Compute[:openstack] | server requests', ['openstack']) do Fog::Compute[:openstack].update_server(@server_id, :name => 'fogupdatedserver') end Fog::Compute[:openstack].servers.get(@server_id).wait_for { ready? } - + #ADD SECURITY GROUP tests("#add_security_group(#{@server_id}, #{@security_group_name})").succeeds do Fog::Compute[:openstack].add_security_group(@server_id, @security_group_name) diff --git a/tests/openstack/requests/network/router_tests.rb b/tests/openstack/requests/network/router_tests.rb index 75a3ea4c0..d0d974667 100644 --- a/tests/openstack/requests/network/router_tests.rb +++ b/tests/openstack/requests/network/router_tests.rb @@ -8,11 +8,11 @@ Shindo.tests('Fog::Network[:openstack] | router requests', ['openstack']) do :tenant_id => String, :external_gateway_info => Fog::Nullable::Hash, } - + tests('success') do tests('#create_router').formats({'router' => @router_format}) do attributes = { - :admin_state_up => true, + :admin_state_up => true, :tenant_id => 'tenant_id' } Fog::Network[:openstack].create_router('router_name', attributes).body @@ -30,7 +30,7 @@ Shindo.tests('Fog::Network[:openstack] | router requests', ['openstack']) do tests('#update_router').formats({'router' => @router_format}) do router_id = Fog::Network[:openstack].routers.all.first.id attributes = { - :name => 'net_name', + :name => 'net_name', :external_gateway_info => { :network_id => 'net_id' }, :status => 'ACTIVE', :admin_state_up => true @@ -42,7 +42,7 @@ Shindo.tests('Fog::Network[:openstack] | router requests', ['openstack']) do router_id = Fog::Network[:openstack].routers.all.first.id net = Fog::Network[:openstack].networks.first attributes = { - :name => 'net_name', + :name => 'net_name', :external_gateway_info => net, :status => 'ACTIVE', :admin_state_up => true diff --git a/tests/rackspace/cdn_tests.rb b/tests/rackspace/cdn_tests.rb index 6456e1923..009048079 100644 --- a/tests/rackspace/cdn_tests.rb +++ b/tests/rackspace/cdn_tests.rb @@ -1,5 +1,5 @@ Shindo.tests('Fog::CDN::Rackspace', ['rackspace']) do - + def assert_method(url, method) @service.instance_variable_set "@rackspace_auth_url", url returns(method) { @service.send :authentication_method } @@ -12,15 +12,15 @@ Shindo.tests('Fog::CDN::Rackspace', ['rackspace']) do assert_method 'https://identity.api.rackspacecloud.com', :authenticate_v1 assert_method 'https://identity.api.rackspacecloud.com/v1', :authenticate_v1 - assert_method 'https://identity.api.rackspacecloud.com/v1.1', :authenticate_v1 + assert_method 'https://identity.api.rackspacecloud.com/v1.1', :authenticate_v1 assert_method 'https://identity.api.rackspacecloud.com/v2.0', :authenticate_v2 - - assert_method 'https://lon.identity.api.rackspacecloud.com', :authenticate_v1 + + assert_method 'https://lon.identity.api.rackspacecloud.com', :authenticate_v1 assert_method 'https://lon.identity.api.rackspacecloud.com/v1', :authenticate_v1 assert_method 'https://lon.identity.api.rackspacecloud.com/v1.1', :authenticate_v1 assert_method 'https://lon.identity.api.rackspacecloud.com/v2.0', :authenticate_v2 end - + tests('authentication v1') do pending if Fog.mocking? @@ -32,7 +32,7 @@ Shindo.tests('Fog::CDN::Rackspace', ['rackspace']) do @service.get_containers end tests('custom endpoint') do - @service = Fog::CDN::Rackspace.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v1.0', + @service = Fog::CDN::Rackspace.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v1.0', :rackspace_cdn_url => 'https://my-custom-cdn-endpoint.com' returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true, "uses custom endpoint") { (@service.instance_variable_get("@uri").host =~ /my-custom-cdn-endpoint\.com/) != nil } @@ -41,7 +41,7 @@ Shindo.tests('Fog::CDN::Rackspace', ['rackspace']) do tests('authentication v2') do pending if Fog.mocking? - + tests('variables populated').succeeds do @service = Fog::CDN::Rackspace.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0', :connection_options => { :ssl_verify_peer => true } returns(true, "auth token populated") { !@service.send(:auth_token).nil? } @@ -65,30 +65,30 @@ Shindo.tests('Fog::CDN::Rackspace', ['rackspace']) do @service.get_containers end tests('custom endpoint') do - @service = Fog::CDN::Rackspace.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0', + @service = Fog::CDN::Rackspace.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0', :rackspace_cdn_url => 'https://my-custom-cdn-endpoint.com' returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true, "uses custom endpoint") { (@service.instance_variable_get("@uri").host =~ /my-custom-cdn-endpoint\.com/) != nil } end end - + tests('default auth') do pending if Fog.mocking? - + tests('no params').succeeds do @service = Fog::CDN::Rackspace.new :rackspace_region => nil returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true, "uses DFW") { (@service.instance_variable_get("@uri").host =~ /cdn1/) != nil } @service.get_containers end - + tests('specify region').succeeds do @service = Fog::CDN::Rackspace.new :rackspace_region => :ord returns(true, "auth token populated") { !@service.send(:auth_token).nil? } returns(true) { (@service.instance_variable_get("@uri").host =~ /cdn2/) != nil } @service.get_containers end - + tests('custom endpoint') do @service = Fog::CDN::Rackspace.new :rackspace_cdn_url => 'https://my-custom-cdn-endpoint.com' returns(true, "auth token populated") { !@service.send(:auth_token).nil? } @@ -111,7 +111,7 @@ Shindo.tests('Fog::CDN::Rackspace', ['rackspace']) do end pending if Fog.mocking? - + def container_meta_attributes @cdn.head_container(@directory.key).headers end @@ -129,15 +129,15 @@ Shindo.tests('Fog::CDN::Rackspace', ['rackspace']) do @directory = Fog::Storage[:rackspace].directories.create(directory_attributes) @cdn = @directory.service.cdn - - begin + + begin tests('publish_container').succeeds do returns("False", "CDN is not enabled") { container_meta_attributes['X-CDN-Enabled'] } urls = @cdn.publish_container @directory returns(true, "hash contains expected urls") { Fog::CDN::Rackspace::Base::URI_HEADERS.values.all? { |url_type| urls[url_type] } } - returns("True", "CDN is enabled") { container_meta_attributes['X-Cdn-Enabled'] } + returns("True", "CDN is enabled") { container_meta_attributes['X-Cdn-Enabled'] } end - + tests('urls') do tests('CDN enabled container').returns(false) do @cdn.publish_container @directory @@ -152,22 +152,22 @@ Shindo.tests('Fog::CDN::Rackspace', ['rackspace']) do @cdn.urls(non_existent_container).empty? end end - + tests('urls_from_headers') do - headers = { - "X-Cdn-Streaming-Uri"=>"http://168e307d41afe64f1a62-d1e9259b2132e81da48ed3e1e802ef22.r2.stream.cf1.rackcdn.com", - "X-Cdn-Uri"=>"http://6e8f4bf5125c9c2e4e3a-d1e9259b2132e81da48ed3e1e802ef22.r2.cf1.rackcdn.com", - "Date"=>"Fri, 15 Feb 2013 18:36:41 GMT", - "Content-Length"=>"0", - "X-Trans-Id"=>"tx424df53b79bc43fe994d3cec0c4d2d8a", - "X-Ttl"=>"3600", - "X-Cdn-Ssl-Uri"=>"https://f83cb7d39e0b9ff9581b-d1e9259b2132e81da48ed3e1e802ef22.ssl.cf1.rackcdn.com", - "X-Cdn-Ios-Uri"=>"http://a590286a323fec6aed22-d1e9259b2132e81da48ed3e1e802ef22.iosr.cf1.rackcdn.com", - "X-Cdn-Enabled"=>"True", - "Content-Type"=>"text/html; charset=UTF-8", + headers = { + "X-Cdn-Streaming-Uri"=>"http://168e307d41afe64f1a62-d1e9259b2132e81da48ed3e1e802ef22.r2.stream.cf1.rackcdn.com", + "X-Cdn-Uri"=>"http://6e8f4bf5125c9c2e4e3a-d1e9259b2132e81da48ed3e1e802ef22.r2.cf1.rackcdn.com", + "Date"=>"Fri, 15 Feb 2013 18:36:41 GMT", + "Content-Length"=>"0", + "X-Trans-Id"=>"tx424df53b79bc43fe994d3cec0c4d2d8a", + "X-Ttl"=>"3600", + "X-Cdn-Ssl-Uri"=>"https://f83cb7d39e0b9ff9581b-d1e9259b2132e81da48ed3e1e802ef22.ssl.cf1.rackcdn.com", + "X-Cdn-Ios-Uri"=>"http://a590286a323fec6aed22-d1e9259b2132e81da48ed3e1e802ef22.iosr.cf1.rackcdn.com", + "X-Cdn-Enabled"=>"True", + "Content-Type"=>"text/html; charset=UTF-8", "X-Log-Retention"=>"False" } - + urls = @cdn.send(:urls_from_headers, headers) returns(4) { urls.size } returns("http://168e307d41afe64f1a62-d1e9259b2132e81da48ed3e1e802ef22.r2.stream.cf1.rackcdn.com") { urls[:streaming_uri] } @@ -175,11 +175,11 @@ Shindo.tests('Fog::CDN::Rackspace', ['rackspace']) do returns("https://f83cb7d39e0b9ff9581b-d1e9259b2132e81da48ed3e1e802ef22.ssl.cf1.rackcdn.com") { urls[:ssl_uri] } returns("http://a590286a323fec6aed22-d1e9259b2132e81da48ed3e1e802ef22.iosr.cf1.rackcdn.com") { urls[:ios_uri] } end - + tests('purge') do pending end - + ensure @directory.destroy if @directory end diff --git a/tests/rackspace/models/compute_v2/keypairs_tests.rb b/tests/rackspace/models/compute_v2/keypairs_tests.rb index a9ac0f1d6..5e1e0eb63 100644 --- a/tests/rackspace/models/compute_v2/keypairs_tests.rb +++ b/tests/rackspace/models/compute_v2/keypairs_tests.rb @@ -42,6 +42,6 @@ Shindo.tests('Fog::Compute::RackspaceV2 | key_pairs', ['rackspace']) do ensure key.destroy if key end - + end end diff --git a/tests/rackspace/models/compute_v2/metadata_tests.rb b/tests/rackspace/models/compute_v2/metadata_tests.rb index bc2886991..b2a5e0487 100644 --- a/tests/rackspace/models/compute_v2/metadata_tests.rb +++ b/tests/rackspace/models/compute_v2/metadata_tests.rb @@ -4,13 +4,13 @@ Shindo.tests('Fog::Compute::RackspaceV2 | metadata', ['rackspace']) do service = Fog::Compute::RackspaceV2.new test_time = Time.now.to_i.to_s - + tests('success') do begin - @server = service.servers.create(:name => "fog_server_#{test_time}", + @server = service.servers.create(:name => "fog_server_#{test_time}", :flavor_id => rackspace_test_flavor_id(service), :image_id => rackspace_test_image_id(service)) - + @server.wait_for { ready? } tests('server') do @@ -18,7 +18,7 @@ Shindo.tests('Fog::Compute::RackspaceV2 | metadata', ['rackspace']) do @server.wait_for { ready? } end end - + tests('image') do @image = @server.create_image("fog_image_#{test_time}", :metadata => {:my_key => 'my_value'}) @image.wait_for { ready? } @@ -27,15 +27,15 @@ Shindo.tests('Fog::Compute::RackspaceV2 | metadata', ['rackspace']) do metadata = @image.metadata.all my_metadata = metadata.select {|datum| datum.key == 'my_key'} returns(1) { my_metadata.size } - returns('my_value') {my_metadata[0].value } + returns('my_value') {my_metadata[0].value } end tests("#get('my_key')").returns('my_value') do pending if Fog.mocking? && !mocks_implemented - @image.metadata.get('my_key').value - end + @image.metadata.get('my_key').value + end end - + ensure @image.destroy if @image @server.destroy if @server diff --git a/tests/rackspace/models/compute_v2/server_tests.rb b/tests/rackspace/models/compute_v2/server_tests.rb index 8751b1395..da2545b69 100644 --- a/tests/rackspace/models/compute_v2/server_tests.rb +++ b/tests/rackspace/models/compute_v2/server_tests.rb @@ -67,11 +67,11 @@ Shindo.tests('Fog::Compute::RackspaceV2 | server', ['rackspace']) do model_tests(service.servers, options, true) do @instance.wait_for { ready? } - + tests('#metadata[\'fog_test\']').returns('true') do @instance.metadata['fog_test'] end - + tests("includes #{@network.label}").returns(true) do @instance.addresses.keys.include?(@network.label) end @@ -95,7 +95,7 @@ Shindo.tests('Fog::Compute::RackspaceV2 | server', ['rackspace']) do returns("::1") { @instance.access_ipv6_address } returns(new_name) { @instance.name } end - + tests('#reboot("SOFT")').succeeds do @instance.reboot('SOFT') returns('REBOOT') { @instance.state } @@ -224,13 +224,13 @@ Shindo.tests('Fog::Compute::RackspaceV2 | server', ['rackspace']) do server } - commands = lambda { - Fog::SSH::Mock.data[@address].first[:commands] + commands = lambda { + Fog::SSH::Mock.data[@address].first[:commands] } test("leaves user unlocked only when requested") do create_server.call(ATTRIBUTES.merge(:no_passwd_lock => true)) - commands.call.none? { |c| c =~ /passwd\s+-l\s+root/ } + commands.call.none? { |c| c =~ /passwd\s+-l\s+root/ } end test("provide a password when the passed isn't locked") do @@ -260,7 +260,7 @@ Shindo.tests('Fog::Compute::RackspaceV2 | server', ['rackspace']) do @instance.resize(4) returns('RESIZE') { @instance.state } end - + @instance.wait_for { ready?('VERIFY_RESIZE') } sleep 60 unless Fog.mocking? tests('#revert_resize').succeeds do diff --git a/tests/rackspace/models/identity/service_catalog_tests.rb b/tests/rackspace/models/identity/service_catalog_tests.rb index bad5f6836..3b43643ee 100644 --- a/tests/rackspace/models/identity/service_catalog_tests.rb +++ b/tests/rackspace/models/identity/service_catalog_tests.rb @@ -37,20 +37,20 @@ Shindo.tests('Fog::Rackspace::ServiceCatalog | users', ['rackspace']) do @service_catalog = Fog::Rackspace::Identity::ServiceCatalog.from_response(nil, before_hash) end - + tests('services') do services = ["cloudBlockStorage", "cloudDNS", "cloudDatabases", "cloudFiles", "cloudFilesCDN", "cloudLoadBalancers", "cloudMonitoring", "cloudServers", "cloudServersOpenStack", "not_here"] returns(services) { @service_catalog.services.collect {|s| s.to_s }.sort } end - + tests('get_endpoints') do endpoints = [{"region"=>"DFW", "versionId"=>"2", "tenantId"=>"777", "versionList"=>"https://dfw.servers.api.rackspacecloud.com/", "versionInfo"=>"https://dfw.servers.api.rackspacecloud.com/v2", "publicURL"=>"https://dfw.servers.api.rackspacecloud.com/v2/777"}, {"region"=>"ORD", "versionId"=>"2", "tenantId"=>"777", "versionList"=>"https://ord.servers.api.rackspacecloud.com/", "versionInfo"=>"https://ord.servers.api.rackspacecloud.com/v2", "publicURL"=>"https://ord.servers.api.rackspacecloud.com/v2/777"}, {"versionId"=>"2", "tenantId"=>"777", "versionList"=>"https://servers.api.rackspacecloud.com/", "versionInfo"=>"https://servers.api.rackspacecloud.com/v2", "publicURL"=>"https://servers.api.rackspacecloud.com/v2/777"}] returns(endpoints) { @service_catalog.get_endpoints(:cloudServersOpenStack) } returns(endpoints) { @service_catalog.get_endpoints('cloudServersOpenStack') } returns({}) { @service_catalog.get_endpoints('non-existent') } end - + tests('get_endpoint') do tests('service with mulitple endpoints') do returns("https://dfw.servers.api.rackspacecloud.com/v2/777") { @service_catalog.get_endpoint(:cloudServersOpenStack, :dfw) } @@ -59,7 +59,7 @@ Shindo.tests('Fog::Rackspace::ServiceCatalog | users', ['rackspace']) do returns("https://dfw.servers.api.rackspacecloud.com/v2/777") { @service_catalog.get_endpoint('cloudServersOpenStack', 'dfw') } returns("https://servers.api.rackspacecloud.com/v2/777") { @service_catalog.get_endpoint('cloudServersOpenStack', :global) } end - + tests('with one endpoint') do tests('catalog contains global endpoint') do catalog_hash = [{"type"=>"volume", "endpoints"=>[{"tenantId"=>"777", "publicURL"=>"https://blockstorage.api.rackspacecloud.com/v1/777"}], "name"=>"cloudBlockStorage"}] @@ -98,7 +98,7 @@ Shindo.tests('Fog::Rackspace::ServiceCatalog | users', ['rackspace']) do returns("https://snet-storage101.ord1.clouddrive.com/v1/Mosso777") { @service_catalog.get_endpoint(:cloudFiles, :ord, true) } returns("https://storage101.ord1.clouddrive.com/v1/Mosso777") { @service_catalog.get_endpoint(:cloudFiles, :ord, false) } end - + tests('error conditions') do raises(RuntimeError) { @service_catalog.get_endpoint(:cloudServersOpenStack) } raises(RuntimeError) { @service_catalog.get_endpoint(:cloudServersOpenStack, :sat) } @@ -106,9 +106,9 @@ Shindo.tests('Fog::Rackspace::ServiceCatalog | users', ['rackspace']) do raises(RuntimeError) { @service_catalog.get_endpoint(:not_here, :dfw) } raises(RuntimeError) { @service_catalog.get_endpoint('non-existent') } raises(RuntimeError) { @service_catalog.get_endpoint(:cloudServersOpenStack, :ord, true) } - end + end end - + tests('reload').succeeds do pending if Fog.mocking? diff --git a/tests/rackspace/models/monitoring/alarm_examples_tests.rb b/tests/rackspace/models/monitoring/alarm_examples_tests.rb index 1e3e4b5fa..fd9d56855 100644 --- a/tests/rackspace/models/monitoring/alarm_examples_tests.rb +++ b/tests/rackspace/models/monitoring/alarm_examples_tests.rb @@ -12,7 +12,7 @@ Shindo.tests('Fog::Rackspace::Monitoring | alarm_examples', ['rackspace','racksp service.alarm_examples.get(alarm_example_id) end tests('evaluate').succeeds do - values = {'string'=> '12345'} + values = {'string'=> '12345'} service.alarm_examples.evaluate(alarm_example_id,values) end end diff --git a/tests/rackspace/models/monitoring/alarm_tests.rb b/tests/rackspace/models/monitoring/alarm_tests.rb index d1bf796e8..c34b65d50 100644 --- a/tests/rackspace/models/monitoring/alarm_tests.rb +++ b/tests/rackspace/models/monitoring/alarm_tests.rb @@ -18,7 +18,7 @@ Shindo.tests('Fog::Rackspace::Monitoring | alarm', ['rackspace','rackspace_monit check.entity = entity alarm = Fog::Rackspace::Monitoring::Alarm.new alarm.check = check.id - + returns(Fog::Rackspace::Monitoring::Alarm) { alarm.class } returns(check_id) { alarm.check.id } end diff --git a/tests/rackspace/models/monitoring/check_types_tests.rb b/tests/rackspace/models/monitoring/check_types_tests.rb index 9d30fd2ad..2377f9995 100644 --- a/tests/rackspace/models/monitoring/check_types_tests.rb +++ b/tests/rackspace/models/monitoring/check_types_tests.rb @@ -1,9 +1,9 @@ Shindo.tests('Fog::Rackspace::Monitoring | check_types', ['rackspace','rackspace_monitoring']) do pending if Fog.mocking? service = Fog::Rackspace::Monitoring.new - + @check_types = service.check_types - + tests('#all').succeeds do @check_types.all end diff --git a/tests/rackspace/models/monitoring/data_points_tests.rb b/tests/rackspace/models/monitoring/data_points_tests.rb index fe0086002..1875e4b9c 100644 --- a/tests/rackspace/models/monitoring/data_points_tests.rb +++ b/tests/rackspace/models/monitoring/data_points_tests.rb @@ -1,14 +1,14 @@ Shindo.tests('Fog::Rackspace::Monitoring | datapoints', ['rackspace','rackspace_monitoring']) do pending if Fog.mocking? service = Fog::Rackspace::Monitoring.new - + begin label = "fog_#{Time.now.to_i.to_s}" @entity = service.entities.create :label => label @check = service.checks.create CHECK_CREATE_OPTIONS.merge(:label => label, :entity => @entity) sleep(@check.period + 30) unless Fog.mocking? @metric = service.metrics(:check => @check).first - + tests('#datapoints').succeeds do service.data_points(:metric => @metric).fetch({ :from => ((Time.now.to_i * 1000) - (3600 * 1000)) }) end diff --git a/tests/rackspace/models/monitoring/metric_tests.rb b/tests/rackspace/models/monitoring/metric_tests.rb index a907f4a9f..53e1fe72b 100644 --- a/tests/rackspace/models/monitoring/metric_tests.rb +++ b/tests/rackspace/models/monitoring/metric_tests.rb @@ -1,14 +1,14 @@ Shindo.tests('Fog::Rackspace::Monitoring | metrics', ['rackspace','rackspace_monitoring']) do pending if Fog.mocking? service = Fog::Rackspace::Monitoring.new - + begin label = "fog_#{Time.now.to_i.to_s}" @entity = service.entities.create :label => label @check = service.checks.create CHECK_CREATE_OPTIONS.merge(:label => label, :entity => @entity) sleep(@check.period + 30) unless Fog.mocking? @metric = service.metrics(:check => @check).first - + tests('#datapoints').succeeds do @metric.datapoints end diff --git a/tests/rackspace/models/monitoring/metrics_tests.rb b/tests/rackspace/models/monitoring/metrics_tests.rb index 46d6a9821..7805cc42d 100644 --- a/tests/rackspace/models/monitoring/metrics_tests.rb +++ b/tests/rackspace/models/monitoring/metrics_tests.rb @@ -6,7 +6,7 @@ Shindo.tests('Fog::Rackspace::Monitoring | metrics', ['rackspace','rackspace_mon label = "fog_#{Time.now.to_i.to_s}" @entity = service.entities.create :label => label @check = service.checks.create CHECK_CREATE_OPTIONS.merge(:label => label, :entity => @entity) - + tests('#list_metrics').succeeds do service.metrics(:check => @check).all end diff --git a/tests/rackspace/models/monitoring/notification_tests.rb b/tests/rackspace/models/monitoring/notification_tests.rb index 08ba1ea39..96417f9e2 100644 --- a/tests/rackspace/models/monitoring/notification_tests.rb +++ b/tests/rackspace/models/monitoring/notification_tests.rb @@ -3,7 +3,7 @@ Shindo.tests('Fog::Rackspace::Monitoring | notification', ['rackspace','rackspac service = Fog::Rackspace::Monitoring.new options = { :label => "fog_#{Time.now.to_i.to_s}", :type => "email", :details => {:address => "test@test.com"} } - + model_tests(service.notifications, options, false) do tests('#update').succeeds do diff --git a/tests/rackspace/models/storage/account_tests.rb b/tests/rackspace/models/storage/account_tests.rb index c6e9f4a7a..27ea24360 100644 --- a/tests/rackspace/models/storage/account_tests.rb +++ b/tests/rackspace/models/storage/account_tests.rb @@ -19,7 +19,7 @@ Shindo.tests('Fog::Rackspace::Storage | account', ['rackspace']) do key = "testing-update-#{Time.now.to_i}" @account.meta_temp_url_key = "testing-update-#{Time.now.to_i}" @account.save - + headers = @account.service.head_containers.headers returns(key) { headers['X-Account-Meta-Temp-Url-Key'] } end diff --git a/tests/rackspace/models/storage/directories_tests.rb b/tests/rackspace/models/storage/directories_tests.rb index a03d2262b..fed33ddc5 100644 --- a/tests/rackspace/models/storage/directories_tests.rb +++ b/tests/rackspace/models/storage/directories_tests.rb @@ -4,7 +4,7 @@ Shindo.tests('Fog::Rackspace::Storage | directories', ['rackspace']) do begin @name = "fog-directories-test-#{Time.now.to_i.to_s}" - @filename = 'lorem.txt' + @filename = 'lorem.txt' @dir = @service.directories.create :key => @name, :metadata => {:fog_test => true} @file = @dir.files.create :key => @filename, :body => lorem_file @@ -17,10 +17,10 @@ Shindo.tests('Fog::Rackspace::Storage | directories', ['rackspace']) do returns( Fog::Storage.get_body_size(lorem_file)) {instance.bytes } returns(@filename) { instance.files.first.key } end - + ensure @file.destroy if @file @dir.destroy if @dir end - + end diff --git a/tests/rackspace/models/storage/directory_tests.rb b/tests/rackspace/models/storage/directory_tests.rb index 7b453c384..e6723e9a9 100644 --- a/tests/rackspace/models/storage/directory_tests.rb +++ b/tests/rackspace/models/storage/directory_tests.rb @@ -1,41 +1,41 @@ Shindo.tests('Fog::Rackspace::Storage | directory', ['rackspace']) do @service = Fog::Storage[:rackspace] - + def container_meta_attributes @service.head_container(@instance.key).headers.reject {|k, v| !(k =~ /X-Container-Meta-/)} end - + directory_attributes = { # Add a random suffix to prevent collision :key => "fog-directory-tests-#{rand(65536)}" } - + model_tests(@service.directories, directory_attributes, Fog.mocking?) do - + tests('#public?').returns(false) do @instance.public? end - + tests('#public_url') do - + tests('http').returns(nil) do @instance.public_url end - @instance.cdn_cname = "my_cname.com" + @instance.cdn_cname = "my_cname.com" tests('cdn_cname').returns(nil) do @instance.public_url end - + @instance.cdn_cname = nil @service.instance_variable_set "@rackspace_cdn_ssl", true tests('ssl').returns(nil) do @instance.public_url - end - @service.instance_variable_set "@rackspace_cdn_ssl", nil + end + @service.instance_variable_set "@rackspace_cdn_ssl", nil end - + tests('#ios_url').returns(nil) do @instance.ios_url end @@ -43,11 +43,11 @@ Shindo.tests('Fog::Rackspace::Storage | directory', ['rackspace']) do tests('#streaming_url').returns(nil) do @instance.streaming_url end - + tests('cdn') do @instance.public = true @instance.save - + tests('#public?').returns(true) do @instance.public? end @@ -58,7 +58,7 @@ Shindo.tests('Fog::Rackspace::Storage | directory', ['rackspace']) do @instance.public_url =~ /http:\/\// end - @instance.cdn_cname = "my_cname.com" + @instance.cdn_cname = "my_cname.com" tests('cdn_cname').returns(0) do @instance.public_url =~ /my_cname\.com/ end @@ -67,7 +67,7 @@ Shindo.tests('Fog::Rackspace::Storage | directory', ['rackspace']) do @service.instance_variable_set "@rackspace_cdn_ssl", true tests('ssl').returns(0) do @instance.public_url =~ /https:\/\/.+\.ssl\./ - end + end @service.instance_variable_set "@rackspace_cdn_ssl", nil end @@ -78,13 +78,13 @@ Shindo.tests('Fog::Rackspace::Storage | directory', ['rackspace']) do tests('#streaming_url').returns(0) do @instance.streaming_url =~ /http:\/\/.+\.stream\./ end - + end tests("reload") do @instance.reload returns(nil) { @instance.instance_variable_get("@urls") } returns(nil) { @instance.instance_variable_get("@files") } - returns(nil) { @instance.instance_variable_get("@public") } + returns(nil) { @instance.instance_variable_get("@public") } end end @@ -112,27 +112,27 @@ Shindo.tests('Fog::Rackspace::Storage | directory', ['rackspace']) do @instance.save container_meta_attributes end - + tests('should retrieve metadata when necessary') do @service.put_container(@instance.key, {"X-Container-Meta-List-Test"=>"true"} ) dir = @service.directories.find {|d| d.key == @instance.key } returns(nil) { dir.instance_variable_get("@metadata") } returns('true') { dir.metadata[:list_test] } end - + tests("should reload metadata after calling reload").returns("42") do @service.put_container @instance.key, "X-Container-Meta-Answer" => 42 @instance.reload @instance.metadata[:answer] end - + tests("should reload metadata after calling reload").returns("42") do @service.put_container @instance.key, "X-Container-Meta-Answer" => 42 @instance.reload @instance.metadata[:answer] end - + end end - + end diff --git a/tests/rackspace/models/storage/file_tests.rb b/tests/rackspace/models/storage/file_tests.rb index e347205fe..160f0082e 100644 --- a/tests/rackspace/models/storage/file_tests.rb +++ b/tests/rackspace/models/storage/file_tests.rb @@ -68,7 +68,7 @@ Shindo.tests('Fog::Rackspace::Storage | file', ['rackspace']) do tests('#metadata') do before do - @instance.metadata[:foo] = 'bar' + @instance.metadata[:foo] = 'bar' @instance.save end @@ -89,17 +89,17 @@ Shindo.tests('Fog::Rackspace::Storage | file', ['rackspace']) do @instance.metadata[:foo] = nil @instance.save object_meta_attributes - end + end tests("removes one key while leaving the other") do @instance.metadata[:color] = "green" @instance.save returns({"X-Object-Meta-Foo"=>"bar", "X-Object-Meta-Color"=>"green"}) { object_meta_attributes } - + tests("set metadata[:color] = nil").returns({"X-Object-Meta-Foo"=>"bar"}) do @instance.metadata[:color] = nil @instance.save - + object_meta_attributes end end @@ -118,10 +118,10 @@ Shindo.tests('Fog::Rackspace::Storage | file', ['rackspace']) do ensure @file.destroy if @file end - + tests('urls') do tests('no CDN') do - + tests('url') do tests('http').succeeds do expire_time = Time.now + 3600 @@ -152,7 +152,7 @@ Shindo.tests('Fog::Rackspace::Storage | file', ['rackspace']) do @directory.service.instance_variable_set "@rackspace_cdn_ssl", true tests('ssl').returns(nil) do @instance.public_url - end + end @directory.service.instance_variable_set "@rackspace_cdn_ssl", nil end @@ -168,12 +168,12 @@ Shindo.tests('Fog::Rackspace::Storage | file', ['rackspace']) do tests('#public_url') do @directory.public = true @directory.save - + tests('http').returns(0) do @instance.public_url =~ /http:\/\/.*#{@instance.key}/ end - @directory.cdn_cname = "my_cname.com" + @directory.cdn_cname = "my_cname.com" tests('cdn_cname').returns(0) do @instance.public_url =~ /my_cname\.com.*#{@instance.key}/ end @@ -182,7 +182,7 @@ Shindo.tests('Fog::Rackspace::Storage | file', ['rackspace']) do @directory.service.instance_variable_set "@rackspace_cdn_ssl", true tests('ssl').returns(0) do @instance.public_url =~ /https:\/\/.+\.ssl\..*#{@instance.key}/ - end + end @directory.service.instance_variable_set "@rackspace_cdn_ssl", nil end @@ -216,33 +216,33 @@ Shindo.tests('Fog::Rackspace::Storage | file', ['rackspace']) do end end end - + tests('#metadata keys') do - + after do clear_metadata @instance.save end - @instance.metadata[:foo_bar] = 'baz' + @instance.metadata[:foo_bar] = 'baz' tests("should support compound key names").returns('baz') do @instance.save object_meta_attributes['X-Object-Meta-Foo-Bar'] end - @instance.metadata['foo'] = 'bar' + @instance.metadata['foo'] = 'bar' tests("should support string keys").returns('bar') do @instance.save object_meta_attributes['X-Object-Meta-Foo'] end - @instance.metadata['foo_bar'] = 'baz' + @instance.metadata['foo_bar'] = 'baz' tests("should support compound string key names").returns('baz') do @instance.save object_meta_attributes['X-Object-Meta-Foo-Bar'] end - @instance.metadata['foo-bar'] = 'baz' + @instance.metadata['foo-bar'] = 'baz' tests("should support hyphenated keys").returns('baz') do @instance.save object_meta_attributes['X-Object-Meta-Foo-Bar'] @@ -258,22 +258,22 @@ Shindo.tests('Fog::Rackspace::Storage | file', ['rackspace']) do end @instance.access_control_allow_origin = 'http://example.com' - @instance.save + @instance.save tests("#access_control_allow_origin should return access control attribute").returns('http://example.com') do @instance.access_control_allow_origin end @instance.access_control_allow_origin = 'foo' - @instance.save + @instance.save tests("#access_control_allow_origin= should update access_control_allow_origin").returns('bar') do @instance.access_control_allow_origin = 'bar' - @instance.save + @instance.save @instance.access_control_allow_origin end tests("#access_control_allow_origin= should not blow up on nil") do @instance.access_control_allow_origin = nil - @instance.save + @instance.save end end @@ -338,7 +338,7 @@ Shindo.tests('Fog::Rackspace::Storage | file', ['rackspace']) do tests("#origin") do tests("#origin should default to nil").returns(nil) do - @instance.save + @instance.save @instance.origin end @@ -350,7 +350,7 @@ Shindo.tests('Fog::Rackspace::Storage | file', ['rackspace']) do @instance.attributes.delete('Origin') @instance.origin = 'foo' - @instance.save + @instance.save tests("#origin= should update origin").returns('bar') do @instance.origin = 'bar' @instance.save @@ -359,7 +359,7 @@ Shindo.tests('Fog::Rackspace::Storage | file', ['rackspace']) do tests("#origin= should not blow up on nil") do @instance.origin = nil - @instance.save + @instance.save end end diff --git a/tests/rackspace/models/storage/metadata_tests.rb b/tests/rackspace/models/storage/metadata_tests.rb index 1a53ab3c5..99db184a1 100644 --- a/tests/rackspace/models/storage/metadata_tests.rb +++ b/tests/rackspace/models/storage/metadata_tests.rb @@ -4,17 +4,17 @@ require 'fog/rackspace/models/storage/directories' require 'fog/rackspace/models/storage/file' Shindo.tests('Fog::Rackspace::Storage | metadata', ['rackspace']) do - + def assert_directory(obj, assert_value) metadata = Fog::Storage::Rackspace::Metadata.new obj returns(assert_value) { metadata.send :directory? } end - + def assert_file(obj, assert_value) metadata = Fog::Storage::Rackspace::Metadata.new obj returns(assert_value) { metadata.send :file? } end - + tests('Directory') do @directory = Fog::Storage::Rackspace::Directory.new tests('#to_key') do @@ -62,38 +62,38 @@ Shindo.tests('Fog::Rackspace::Storage | metadata', ['rackspace']) do end end - + tests('#to_header_key') do metadata = Fog::Storage::Rackspace::Metadata.new @directory - + tests('key to add').returns("X-Container-Meta-Thumbnail-Image") do metadata.send(:to_header_key, :thumbnail_image, true) end - + tests('key to remove').returns("X-Remove-Container-Meta-Thumbnail-Image") do metadata.send(:to_header_key, :thumbnail_image, nil) - end + end end - + tests('#to_headers').returns({"X-Container-Meta-Preview"=>true, "X-Remove-Container-Meta-Delete-Me"=>1}) do metadata = Fog::Storage::Rackspace::Metadata.new @directory metadata[:preview] = true metadata[:delete_me] = nil - - metadata.to_headers + + metadata.to_headers end - + tests("#from_headers").returns({:my_boolean=>"true", :my_integer=>"42", :my_string=>"I am a string"}) do headers = { "X-Container-Meta-My-Integer"=> "42", - "X-Container-Meta-My-Boolean"=> "true", - "X-Container-Meta-My-String"=> "I am a string" + "X-Container-Meta-My-Boolean"=> "true", + "X-Container-Meta-My-String"=> "I am a string" } metadata = Fog::Storage::Rackspace::Metadata.from_headers @directory, headers metadata.data end - + tests("#delete").returns({"X-Remove-Container-Meta-Delete-Me"=>1}) do metadata = Fog::Storage::Rackspace::Metadata.new @directory metadata.delete(:delete_me) @@ -124,7 +124,7 @@ Shindo.tests('Fog::Rackspace::Storage | metadata', ['rackspace']) do tests('key to remove').returns("X-Remove-Object-Meta-Thumbnail-Image") do metadata.send(:to_header_key, :thumbnail_image, nil) - end + end end tests('#to_headers').returns({"X-Object-Meta-Preview"=>true, "X-Remove-Object-Meta-Delete-Me"=>1}) do @@ -132,13 +132,13 @@ Shindo.tests('Fog::Rackspace::Storage | metadata', ['rackspace']) do metadata[:preview] = true metadata[:delete_me] = nil - metadata.to_headers + metadata.to_headers end tests("#from_headers").returns({:my_boolean=>"true", :my_integer=>"42", :my_string=>"I am a string"}) do headers = { "X-Object-Meta-My-Integer"=> "42", - "X-Object-Meta-My-Boolean"=> "true", + "X-Object-Meta-My-Boolean"=> "true", "X-Object-Meta-My-String"=> "I am a string" } @@ -153,7 +153,7 @@ Shindo.tests('Fog::Rackspace::Storage | metadata', ['rackspace']) do metadata.to_headers end end - + tests("#respond_to?") do tests('Should respond to all of the methods in Hash class').returns(true) do metadata = Fog::Storage::Rackspace::Metadata.new @file @@ -164,45 +164,45 @@ Shindo.tests('Fog::Rackspace::Storage | metadata', ['rackspace']) do metadata.methods.all? {|method| metadata.respond_to?(method)} end end - + tests("#method_missing").returns(true) do metadata = Fog::Storage::Rackspace::Metadata.new @file metadata[:test] = true metadata[:test] end - + tests('#directory?') do assert_directory Fog::Storage::Rackspace::Directories, true - assert_directory Fog::Storage::Rackspace::Directory, true + assert_directory Fog::Storage::Rackspace::Directory, true assert_directory Fog::Storage::Rackspace::Directory.new, true assert_directory nil, false assert_directory Fog::Storage::Rackspace::Files, false assert_directory Fog::Storage::Rackspace::File, false assert_directory Fog::Storage::Rackspace::File.new, false - assert_directory "I am a string!", false + assert_directory "I am a string!", false end - + tests('#file?') do assert_file Fog::Storage::Rackspace::Directories, false - assert_file Fog::Storage::Rackspace::Directory, false + assert_file Fog::Storage::Rackspace::Directory, false assert_file Fog::Storage::Rackspace::Directory.new, false assert_file nil, false assert_file Fog::Storage::Rackspace::Files, true assert_file Fog::Storage::Rackspace::File, true assert_file Fog::Storage::Rackspace::File.new, true - assert_file "I am a string!", false + assert_file "I am a string!", false end - + tests('#parent_class') do tests('Fog::Storage::Rackspace::Directory object') do metadata = Fog::Storage::Rackspace::Metadata.new Fog::Storage::Rackspace::Directory.new - returns(Fog::Storage::Rackspace::Directory) { metadata.send :parent_class } + returns(Fog::Storage::Rackspace::Directory) { metadata.send :parent_class } end tests('Fog::Storage::Rackspace::Directory class') do metadata = Fog::Storage::Rackspace::Metadata.new Fog::Storage::Rackspace::Directory - returns(Fog::Storage::Rackspace::Directory) { metadata.send :parent_class } + returns(Fog::Storage::Rackspace::Directory) { metadata.send :parent_class } end end end diff --git a/tests/rackspace/requests/auto_scale/config_tests.rb b/tests/rackspace/requests/auto_scale/config_tests.rb index 68a2f5c67..ba7838281 100644 --- a/tests/rackspace/requests/auto_scale/config_tests.rb +++ b/tests/rackspace/requests/auto_scale/config_tests.rb @@ -1,5 +1,5 @@ Shindo.tests('Fog::Rackspace::AutoScale | config_tests', ['rackspace', 'rackspace_autoscale']) do - + pending if Fog.mocking? service = Fog::Rackspace::AutoScale.new :rackspace_region => :ord diff --git a/tests/rackspace/requests/auto_scale/group_tests.rb b/tests/rackspace/requests/auto_scale/group_tests.rb index ed05538e5..0cb4b43ec 100644 --- a/tests/rackspace/requests/auto_scale/group_tests.rb +++ b/tests/rackspace/requests/auto_scale/group_tests.rb @@ -1,8 +1,8 @@ Shindo.tests('Fog::Rackspace::AutoScale | group_tests', ['rackspace', 'rackspace_autoscale']) do - - pending if Fog.mocking? + + pending if Fog.mocking? service = Fog::Rackspace::AutoScale.new :rackspace_region => :ord - + tests('success') do tests('#create new group').formats(GROUP_FORMAT) do response = service.create_group(LAUNCH_CONFIG_OPTIONS, GROUP_CONFIG_OPTIONS, POLICIES_OPTIONS).body diff --git a/tests/rackspace/requests/auto_scale/helper.rb b/tests/rackspace/requests/auto_scale/helper.rb index 21307efc2..040397689 100644 --- a/tests/rackspace/requests/auto_scale/helper.rb +++ b/tests/rackspace/requests/auto_scale/helper.rb @@ -28,23 +28,23 @@ GROUP_STATE_FORMAT = { } GET_GROUP_HEADERS_FORMAT = { - "Content-Type"=>String, - "Via"=>String, - "x-response-id"=>String, - "Date"=>String, - "Transfer-Encoding"=>String, + "Content-Type"=>String, + "Via"=>String, + "x-response-id"=>String, + "Date"=>String, + "Transfer-Encoding"=>String, "Server"=>String } GROUP_DELETE_DATA_FORMAT = { :headers=> { - "Content-Type"=>String, - "Via"=>String, - "x-response-id"=>String, - "Date"=>String, + "Content-Type"=>String, + "Via"=>String, + "x-response-id"=>String, + "Date"=>String, "Server"=>String - }, - :status=>Integer, + }, + :status=>Integer, :remote_ip=>String } @@ -97,11 +97,11 @@ GROUP_CONFIG_FORMAT = { } POLICY_FORMAT = { - "name"=> String, - "links"=> Array, - "cooldown"=>Integer, - "type"=>String, - "id"=>String, + "name"=> String, + "links"=> Array, + "cooldown"=>Integer, + "type"=>String, + "id"=>String, "change"=>Integer } diff --git a/tests/rackspace/requests/auto_scale/policy_tests.rb b/tests/rackspace/requests/auto_scale/policy_tests.rb index c16add318..a1ac911a9 100644 --- a/tests/rackspace/requests/auto_scale/policy_tests.rb +++ b/tests/rackspace/requests/auto_scale/policy_tests.rb @@ -1,4 +1,4 @@ -Shindo.tests('Fog::Rackspace::AutoScale | policy_tests', ['rackspace', 'rackspace_autoscale']) do +Shindo.tests('Fog::Rackspace::AutoScale | policy_tests', ['rackspace', 'rackspace_autoscale']) do pending if Fog.mocking? service = Fog::Rackspace::AutoScale.new :rackspace_region => :ord @@ -58,11 +58,11 @@ Shindo.tests('Fog::Rackspace::AutoScale | policy_tests', ['rackspace', 'rackspac tests('#update policy').raises(Fog::Rackspace::AutoScale::BadRequest) do service.update_policy(@group_id, 123, {}) end - + tests('#execute policy').raises(Fog::Rackspace::AutoScale::NotFound) do service.execute_policy(@group_id, 123) end - + tests('#delete policy').raises(Fog::Rackspace::AutoScale::NotFound) do service.delete_policy(@group_id, 123) end diff --git a/tests/rackspace/requests/cdn/cdn_tests.rb b/tests/rackspace/requests/cdn/cdn_tests.rb index 1443e3712..f1684ca4e 100644 --- a/tests/rackspace/requests/cdn/cdn_tests.rb +++ b/tests/rackspace/requests/cdn/cdn_tests.rb @@ -12,7 +12,7 @@ Shindo.tests('Fog::CDN[:rackspace] | CDN requests', ['rackspace']) do "cdn_ssl_uri" => String, "cdn_uri" => String }] - + @container_headers = { "Content-Length" => String, "X-Cdn-Enabled" => String, @@ -25,13 +25,13 @@ Shindo.tests('Fog::CDN[:rackspace] | CDN requests', ['rackspace']) do "X-Trans-Id" => String, "Date" => String } - - begin + + begin unless Fog.mocking? @directory = Fog::Storage[:rackspace].directories.create(:key => 'fogcontainertests') @file = @directory.files.create(:key => 'fog_object', :body => lorem_file) end - + tests('success') do tests("#put_container('fogcontainertests')").succeeds do @@ -52,7 +52,7 @@ Shindo.tests('Fog::CDN[:rackspace] | CDN requests', ['rackspace']) do #NOTE: you are only allow 25 object purges per day. If this fails, you may be over the limit tests("#delete_object('fog_object')").succeeds do - Fog::CDN[:rackspace].delete_object('fogcontainertests', 'fog_object') + Fog::CDN[:rackspace].delete_object('fogcontainertests', 'fog_object') end end ensure @@ -61,13 +61,13 @@ Shindo.tests('Fog::CDN[:rackspace] | CDN requests', ['rackspace']) do @directory.destroy if @directory end end - + tests('failure') do - + tests("#head_container('missing_container')").raises(Fog::Storage::Rackspace::NotFound) do Fog::CDN[:rackspace].head_container('missing_container') end - + tests("#post_container('missing_container')").raises(Fog::Storage::Rackspace::NotFound) do Fog::CDN[:rackspace].post_container('missing_container', 'X-TTL' => 5000) end diff --git a/tests/rackspace/requests/compute/address_tests.rb b/tests/rackspace/requests/compute/address_tests.rb index ef38c7008..c7d1ee7b1 100644 --- a/tests/rackspace/requests/compute/address_tests.rb +++ b/tests/rackspace/requests/compute/address_tests.rb @@ -1,9 +1,9 @@ Shindo.tests('Fog::Compute[:rackspace] | address requests', ['rackspace']) do @service = Fog::Compute.new(:provider => :rackspace, :version => :v1) - + tests('success') do - + @server = @service.servers.create(:flavor_id => 1, :image_id => 19) tests("#list_addresses(#{@server.id})").formats({'addresses' => {'private' => [String], 'public' => [String]}}) do @@ -24,7 +24,7 @@ Shindo.tests('Fog::Compute[:rackspace] | address requests', ['rackspace']) do end tests('failure') do - + tests('#list_addresses(0)').raises(Fog::Compute::Rackspace::NotFound) do @service.list_addresses(0) end diff --git a/tests/rackspace/requests/compute/flavor_tests.rb b/tests/rackspace/requests/compute/flavor_tests.rb index 59874a6fa..1969f6a8a 100644 --- a/tests/rackspace/requests/compute/flavor_tests.rb +++ b/tests/rackspace/requests/compute/flavor_tests.rb @@ -7,7 +7,7 @@ Shindo.tests('Fog::Compute[:rackspace] | flavor requests', ['rackspace']) do 'ram' => Integer } - @service = Fog::Compute.new(:provider => :rackspace, :version => :v1) + @service = Fog::Compute.new(:provider => :rackspace, :version => :v1) tests('success') do tests('#get_flavor_details(1)').formats(@flavor_format) do diff --git a/tests/rackspace/requests/compute/image_tests.rb b/tests/rackspace/requests/compute/image_tests.rb index 4f486b4ac..2307be131 100644 --- a/tests/rackspace/requests/compute/image_tests.rb +++ b/tests/rackspace/requests/compute/image_tests.rb @@ -10,7 +10,7 @@ Shindo.tests('Fog::Compute[:rackspace] | image requests', ['rackspace']) do 'updated' => String } - @service = Fog::Compute.new(:provider => :rackspace, :version => :v1) + @service = Fog::Compute.new(:provider => :rackspace, :version => :v1) tests('success') do diff --git a/tests/rackspace/requests/compute/server_tests.rb b/tests/rackspace/requests/compute/server_tests.rb index 4d6229748..d17c178c4 100644 --- a/tests/rackspace/requests/compute/server_tests.rb +++ b/tests/rackspace/requests/compute/server_tests.rb @@ -14,8 +14,8 @@ Shindo.tests('Fog::Compute[:rackspace] | server requests', ['rackspace']) do 'progress' => Integer, 'status' => String } - - @service = Fog::Compute.new(:provider => :rackspace, :version => :v1) + + @service = Fog::Compute.new(:provider => :rackspace, :version => :v1) tests('success') do diff --git a/tests/rackspace/requests/compute_v2/address_tests.rb b/tests/rackspace/requests/compute_v2/address_tests.rb index 361082c48..296ed677e 100644 --- a/tests/rackspace/requests/compute_v2/address_tests.rb +++ b/tests/rackspace/requests/compute_v2/address_tests.rb @@ -3,7 +3,7 @@ Shindo.tests('Fog::Compute::RackspaceV2 | address requests', ['rackspace']) do @service = Fog::Compute.new(:provider => 'Rackspace', :version => 'V2') image_id = rackspace_test_image_id(@service) flavor_id = rackspace_test_flavor_id(@service) - + tests('success') do unless Fog.mocking? @server = @service.servers.create(:flavor_id => flavor_id, :image_id => image_id, :name => "address-tests-#{Time.now.to_i}") @@ -12,17 +12,17 @@ Shindo.tests('Fog::Compute::RackspaceV2 | address requests', ['rackspace']) do else @server_id = 42 end - - address_format = { "addresses"=> { - "private" => [{"addr" => String, "version" => Integer}], + + address_format = { "addresses"=> { + "private" => [{"addr" => String, "version" => Integer}], "public" => [{"addr" => String, "version" => Integer }, {"addr"=> String, "version" => Integer}]} } - begin + begin tests("#list_addresses(#{@server_id})").formats(address_format) do @service.list_addresses(@server_id).body end - + tests("#list_addresses_by_network(#{@server_id}, 'private')").formats(address_format["addresses"].reject {|k,v| k != "private"}) do @service.list_addresses_by_network(@server_id, "private").body end diff --git a/tests/rackspace/requests/compute_v2/image_tests.rb b/tests/rackspace/requests/compute_v2/image_tests.rb index 2c46f996a..895cc1562 100644 --- a/tests/rackspace/requests/compute_v2/image_tests.rb +++ b/tests/rackspace/requests/compute_v2/image_tests.rb @@ -1,6 +1,6 @@ Shindo.tests('Fog::Compute::RackspaceV2 | image_tests', ['rackspace']) do service = Fog::Compute.new(:provider => 'Rackspace', :version => 'V2') - + image_format = { 'id' => String, 'name' => String, @@ -32,7 +32,7 @@ Shindo.tests('Fog::Compute::RackspaceV2 | image_tests', ['rackspace']) do begin test_time = Time.now.to_i.to_s @server = service.servers.create(:name => "fog-image-tests_#{test_time}", - :flavor_id => rackspace_test_flavor_id(service), + :flavor_id => rackspace_test_flavor_id(service), :image_id => rackspace_test_image_id(service)) @server.wait_for { ready? } @image_id = nil @@ -70,7 +70,7 @@ Shindo.tests('Fog::Compute::RackspaceV2 | image_tests', ['rackspace']) do service.get_image(Fog::Rackspace::MockData::NOT_FOUND_ID) end end - ensure + ensure @image.destroy if @image @server.destroy if @server end diff --git a/tests/rackspace/requests/compute_v2/metadata_tests.rb b/tests/rackspace/requests/compute_v2/metadata_tests.rb index 61a9959be..3617453d1 100644 --- a/tests/rackspace/requests/compute_v2/metadata_tests.rb +++ b/tests/rackspace/requests/compute_v2/metadata_tests.rb @@ -1,22 +1,22 @@ Shindo.tests('Fog::Compute::RackspaceV2 | metadata_tests', ['rackspace']) do - + @service = Fog::Compute.new(:provider => 'Rackspace', :version => 'V2') image_id = rackspace_test_image_id(@service) flavor_id = rackspace_test_flavor_id(@service) - + tests('success') do begin metadata = {"tag" => "database"} - + unless Fog.mocking? name = "fog-server-metadata-#{Time.now.to_i}" - @server = @service.servers.create(:name => name, + @server = @service.servers.create(:name => name, :flavor_id => flavor_id, :image_id => image_id, :metadata => metadata) @server.wait_for { ready? } - - + + @server_id = @server.id @image = @server.create_image(name, :metadata => metadata) @image_id = @image.id @@ -24,7 +24,7 @@ Shindo.tests('Fog::Compute::RackspaceV2 | metadata_tests', ['rackspace']) do @image_id = 1 @server_id = 1 end - + tests("servers") do tests('list_metadata').returns("metadata" => metadata) do @service.list_metadata("servers", @server_id).body @@ -45,21 +45,21 @@ Shindo.tests('Fog::Compute::RackspaceV2 | metadata_tests', ['rackspace']) do @service.delete_metadata_item("servers", @server_id, "environment") end end - + tests("images") do @image.wait_for { ready? } unless Fog.mocking? - + tests('list_metadata').returns(metadata) do h = @service.list_metadata("images", @image_id).body h["metadata"].reject {|k,v| k.downcase != "tag"} #only look at the metadata we created end tests('set_metadata').returns({"environment" => "dev"}) do h = @service.set_metadata("images", @image_id, {"environment" => "dev"}).body - h["metadata"].reject {|k,v| k.downcase != "environment"} #only look at the metadata we created + h["metadata"].reject {|k,v| k.downcase != "environment"} #only look at the metadata we created end tests('update_metadata').returns({"environment" => "dev", "tag" => "database"}) do h = @service.update_metadata("images", @image_id, {"environment" => "dev", "tag" => "database"}).body - h["metadata"].reject {|k,v| !['environment', 'tag'].include?(k.downcase)} #only look at the metadata we created + h["metadata"].reject {|k,v| !['environment', 'tag'].include?(k.downcase)} #only look at the metadata we created end tests('get_metadata_item').returns("meta" => {"environment" => "dev"}) do @service.get_metadata_item("images", @image_id, "environment").body @@ -73,7 +73,7 @@ Shindo.tests('Fog::Compute::RackspaceV2 | metadata_tests', ['rackspace']) do end ensure @image.destroy if @image - @server.destroy if @server + @server.destroy if @server end end @@ -93,10 +93,10 @@ Shindo.tests('Fog::Compute::RackspaceV2 | metadata_tests', ['rackspace']) do @service.get_metadata_item(collection, 0, "environment") end tests('set_server_metadata_item').raises(Fog::Compute::RackspaceV2::NotFound) do - @service.set_metadata_item(collection, 0, "environment", "test") + @service.set_metadata_item(collection, 0, "environment", "test") end tests('delete_server_metadata_item').raises(Fog::Compute::RackspaceV2::NotFound) do - @service.delete_metadata_item(collection, 0, "environment") + @service.delete_metadata_item(collection, 0, "environment") end end end diff --git a/tests/rackspace/requests/compute_v2/server_tests.rb b/tests/rackspace/requests/compute_v2/server_tests.rb index 486d066f8..f637ea01d 100644 --- a/tests/rackspace/requests/compute_v2/server_tests.rb +++ b/tests/rackspace/requests/compute_v2/server_tests.rb @@ -68,7 +68,7 @@ Shindo.tests('Fog::Compute::RackspaceV2 | server_tests', ['rackspace']) do body end wait_for_server_state(service, server_id, 'ACTIVE', 'ERROR') - + tests('#list_servers').formats(list_servers_format, false) do service.list_servers.body end @@ -80,10 +80,10 @@ Shindo.tests('Fog::Compute::RackspaceV2 | server_tests', ['rackspace']) do tests("#update_server(#{server_id}, #{server_name}_update) LEGACY").formats(get_server_format) do service.update_server(server_id, "#{server_name}_update").body end - + tests("#update_server(#{server_id}, { 'name' => #{server_name}_update)} ").formats(get_server_format) do service.update_server(server_id, 'name' => "#{server_name}_update").body - end + end tests('#change_server_password').succeeds do service.change_server_password(server_id, 'some_server_password') @@ -101,13 +101,13 @@ Shindo.tests('Fog::Compute::RackspaceV2 | server_tests', ['rackspace']) do end wait_for_server_state(service, server_id, 'ACTIVE', 'ERROR') sleep 120 unless Fog.mocking? - + tests('#resize_server').succeeds do resize_flavor_id = Fog.mocking? ? flavor_id : service.flavors[1].id service.resize_server(server_id, resize_flavor_id) end wait_for_server_state(service, server_id, 'VERIFY_RESIZE', 'ACTIVE') - + tests('#confirm_resize_server').succeeds do service.confirm_resize_server(server_id) end @@ -136,6 +136,6 @@ Shindo.tests('Fog::Compute::RackspaceV2 | server_tests', ['rackspace']) do tests('#delete_server').succeeds do service.delete_server(server_id) - end - end + end + end end diff --git a/tests/rackspace/requests/load_balancers/load_balancer_tests.rb b/tests/rackspace/requests/load_balancers/load_balancer_tests.rb index 525a3cee9..f3568bdc7 100644 --- a/tests/rackspace/requests/load_balancers/load_balancer_tests.rb +++ b/tests/rackspace/requests/load_balancers/load_balancer_tests.rb @@ -15,7 +15,7 @@ Shindo.tests('Fog::Rackspace::LoadBalancers | load_balancer_tests', ['rackspace' end tests("#create_load_balancer(#{@lb_name}, 'HTTP', 80,...with algorithm)").formats(LOAD_BALANCER_FORMAT) do - data = @service.create_load_balancer(@lb_name, 'HTTP', 80, [{ :type => 'PUBLIC'}], + data = @service.create_load_balancer(@lb_name, 'HTTP', 80, [{ :type => 'PUBLIC'}], [{ :address => '1.1.1.1', :port => 80, :condition => 'ENABLED'}], { :algorithm => 'LEAST_CONNECTIONS', :timeout => 30 }).body @lb_id = data['loadBalancer']['id'] diff --git a/tests/rackspace/requests/monitoring/agent_tests.rb b/tests/rackspace/requests/monitoring/agent_tests.rb index c991229ec..e91ca35e2 100644 --- a/tests/rackspace/requests/monitoring/agent_tests.rb +++ b/tests/rackspace/requests/monitoring/agent_tests.rb @@ -4,7 +4,7 @@ Shindo.tests('Fog::Rackspace::Monitoring | agent_tests', ['rackspace','rackspace agent_token = nil options = { "label" => "Bar" } values_format = Hash - + tests('success') do tests('#create new agent token').formats(DATA_FORMAT) do response = account.create_agent_token(options).data @@ -16,7 +16,7 @@ Shindo.tests('Fog::Rackspace::Monitoring | agent_tests', ['rackspace','rackspace end tests("#list_agents") do data_matches_schema(values_format, {:allow_extra_keys => true}) { account.list_agents.body } - end + end tests("#get_agent") do data_matches_schema(values_format, {:allow_extra_keys => true}) { account.get_agent("agent_id").body } end @@ -50,8 +50,8 @@ Shindo.tests('Fog::Rackspace::Monitoring | agent_tests', ['rackspace','rackspace end tests("#get_system_info") do data_matches_schema(values_format, {:allow_extra_keys => true}) { account.get_system_info("agent_id").body } - end - + end + end tests('failure') do @@ -69,6 +69,6 @@ Shindo.tests('Fog::Rackspace::Monitoring | agent_tests', ['rackspace','rackspace end tests('#fail to get agent (-1)').raises(Fog::Rackspace::Monitoring::NotFound) do account.get_agent(-1) - end + end end end diff --git a/tests/rackspace/requests/monitoring/alarm_example_tests.rb b/tests/rackspace/requests/monitoring/alarm_example_tests.rb index 21b904152..0825fe394 100644 --- a/tests/rackspace/requests/monitoring/alarm_example_tests.rb +++ b/tests/rackspace/requests/monitoring/alarm_example_tests.rb @@ -1,5 +1,5 @@ Shindo.tests('Fog::Rackspace::Monitoring | alarm_example_tests', ['rackspace','rackspace_monitoring']) do - pending if Fog.mocking? + pending if Fog.mocking? account = Fog::Rackspace::Monitoring.new example_id = "remote.http_body_match_1" diff --git a/tests/rackspace/requests/monitoring/alarm_tests.rb b/tests/rackspace/requests/monitoring/alarm_tests.rb index c60d66147..b88d41e96 100644 --- a/tests/rackspace/requests/monitoring/alarm_tests.rb +++ b/tests/rackspace/requests/monitoring/alarm_tests.rb @@ -1,5 +1,5 @@ Shindo.tests('Fog::Rackspace::Monitoring | alarm_tests', ['rackspace','rackspace_monitoring']) do - + account = Fog::Rackspace::Monitoring.new entity_id = account.create_entity(:label => "Foo").data[:headers]["X-Object-ID"] diff --git a/tests/rackspace/requests/monitoring/helper.rb b/tests/rackspace/requests/monitoring/helper.rb index 47d39e63e..15cfd4f92 100644 --- a/tests/rackspace/requests/monitoring/helper.rb +++ b/tests/rackspace/requests/monitoring/helper.rb @@ -93,7 +93,7 @@ GET_MONITORING_ZONE = { # "limit"=>Integer, # "marker"=>nil, # "next_marker"=>nil, -# "next_href"=>nil}} +# "next_href"=>nil}} CHECK_CREATE_OPTIONS = { :details => { @@ -131,7 +131,7 @@ OVERVIEW_FORMAT = { :limit => Integer, :marker => String, :next_marker => String, - :next_href => String + :next_href => String } }, :headers => LIST_HEADERS_FORMAT, diff --git a/tests/rackspace/requests/monitoring/list_tests.rb b/tests/rackspace/requests/monitoring/list_tests.rb index 4991ecd62..2236ba7df 100644 --- a/tests/rackspace/requests/monitoring/list_tests.rb +++ b/tests/rackspace/requests/monitoring/list_tests.rb @@ -1,10 +1,10 @@ Shindo.tests('Fog::Rackspace::Monitoring | list_tests', ['rackspace','rackspace_monitoring']) do account = Fog::Rackspace::Monitoring.new - if Fog.mocking? + if Fog.mocking? entity_id = "peoigne93" check_id = "2090wgn93" - else + else entity_id = account.create_entity(:label => "Foo").data[:headers]["X-Object-ID"] check_id = account.create_check(entity_id,CHECK_CREATE_OPTIONS).data[:headers]["X-Object-ID"] end @@ -13,9 +13,9 @@ Shindo.tests('Fog::Rackspace::Monitoring | list_tests', ['rackspace','rackspace_ now = Time.now.to_i SLEEP_TIME= 2 sleep(SLEEP_TIME) unless Fog.mocking? - + tests('success') do - + tests('#get list of monitoring zones').formats(LIST_MONITORING_ZONE) do pending if Fog.mocking? account.list_monitoring_zones.body diff --git a/tests/rackspace/requests/monitoring/notification_tests.rb b/tests/rackspace/requests/monitoring/notification_tests.rb index 01f4cd7f5..7b61c0d36 100644 --- a/tests/rackspace/requests/monitoring/notification_tests.rb +++ b/tests/rackspace/requests/monitoring/notification_tests.rb @@ -5,7 +5,7 @@ Shindo.tests('Fog::Rackspace::Monitoring | notification_tests', ['rackspace','ra tests('#create new notification').formats(DATA_FORMAT) do pending if Fog.mocking? response = account.create_notification(:label => "Foo", :type => "email", :details => {:address => "test@test.com"}).data - + notification_id = response[:headers]["X-Object-ID"] response end diff --git a/tests/rackspace/requests/queues/helper.rb b/tests/rackspace/requests/queues/helper.rb index 3587c73d5..aa1a94e8e 100644 --- a/tests/rackspace/requests/queues/helper.rb +++ b/tests/rackspace/requests/queues/helper.rb @@ -27,7 +27,7 @@ MESSAGE_FORMAT = { LIST_MESSAGES_FORMAT = { 'messages' => [MESSAGE_FORMAT], - 'links' => LINKS_FORMAT + 'links' => LINKS_FORMAT } CREATE_CLAIM_FORMAT = [ diff --git a/tests/riakcs/requests/usage/usage_tests.rb b/tests/riakcs/requests/usage/usage_tests.rb index f46b3e0b1..b25df9901 100644 --- a/tests/riakcs/requests/usage/usage_tests.rb +++ b/tests/riakcs/requests/usage/usage_tests.rb @@ -1,17 +1,17 @@ Shindo.tests('RiakCS::Usage | usage requests', ['riakcs']) do @blank_usage_format = { - 'Access' => { + 'Access' => { 'Nodes' => [], - 'Errors' => [] + 'Errors' => [] }, - 'Storage' => { + 'Storage' => { 'Samples' => [], - 'Errors' => [] + 'Errors' => [] } } - tests('Statistics retrieval with no data returned') do + tests('Statistics retrieval with no data returned') do start_time = Time.now.utc + 86400 end_time = start_time + 86400 diff --git a/tests/serverlove/requests/compute/image_tests.rb b/tests/serverlove/requests/compute/image_tests.rb index 482b0db63..aa523ca7c 100644 --- a/tests/serverlove/requests/compute/image_tests.rb +++ b/tests/serverlove/requests/compute/image_tests.rb @@ -13,7 +13,7 @@ Shindo.tests('Fog::Compute[:serverlove] | drive requests', ['serverlove']) do 'read:requests' => String, 'write:requests' => String } - + tests('success') do attributes = { 'name' => 'Test', 'size' => '24234567890' } @@ -21,23 +21,23 @@ Shindo.tests('Fog::Compute[:serverlove] | drive requests', ['serverlove']) do tests("#create_image").formats(@image_format) do @image = Fog::Compute[:serverlove].create_image(attributes).body end - + tests("#list_images").succeeds do Fog::Compute[:serverlove].images end - + tests("#update_image").returns(true) do @image['name'] = "Diff" Fog::Compute[:serverlove].update_image(@image['drive'], { :name => @image['name'], :size => @image['size']}) Fog::Compute[:serverlove].images.get(@image['drive']).name == "Diff" end - + tests("#load_standard_image").returns(true) do # Load centos Fog::Compute[:serverlove].load_standard_image(@image['drive'], '88ed067f-d2b8-42ce-a25f-5297818a3b6f') Fog::Compute[:serverlove].images.get(@image['drive']).imaging != "" # This will be "x%" when imaging end - + tests("waits for imaging...").returns(true) do while(percent_complete = Fog::Compute[:serverlove].images.get(@image['drive']).imaging) sleep(1) @@ -47,7 +47,7 @@ Shindo.tests('Fog::Compute[:serverlove] | drive requests', ['serverlove']) do STDERR.print "100% " true end - + tests("#destroy_image").succeeds do Fog::Compute[:serverlove].destroy_image(@image['drive']) end diff --git a/tests/serverlove/requests/compute/server_tests.rb b/tests/serverlove/requests/compute/server_tests.rb index c3d370127..b402b9746 100644 --- a/tests/serverlove/requests/compute/server_tests.rb +++ b/tests/serverlove/requests/compute/server_tests.rb @@ -1,5 +1,5 @@ Shindo.tests('Fog::Compute[:serverlove] | server requests', ['serverlove']) do - + @server_format = { 'server' => String, 'name' => String, @@ -15,9 +15,9 @@ Shindo.tests('Fog::Compute[:serverlove] | server requests', ['serverlove']) do 'nic:0:dhcp' => String, 'nic:0:model' => String } - + tests('success') do - + attributes = { 'name' => 'Test', 'cpu' => '1000', 'mem' => '1000', 'persistent' => 'true' } tests("#create_server").formats(@server_format) do @@ -27,20 +27,20 @@ Shindo.tests('Fog::Compute[:serverlove] | server requests', ['serverlove']) do tests("#list_servers").succeeds do Fog::Compute[:serverlove].servers end - + tests("#update_server").returns(true) do @server['name'] = "Diff" Fog::Compute[:serverlove].update_server(@server['server'], { :name => @server['name']}) Fog::Compute[:serverlove].servers.get(@server['server']).name == "Diff" end - + tests("assigns drive to server").succeeds do @image = Fog::Compute[:serverlove].create_image('name' => 'Test', 'size' => '24234567890').body # Load debian Fog::Compute[:serverlove].load_standard_image(@image['drive'], 'aca2fa0b-40bc-4e06-ad99-f1467690d5de') Fog::Compute[:serverlove].update_server(@server['server'], { 'ide:0:0' => @image['drive'], 'boot' => 'ide:0:0'}) end - + tests("waits for imaging...").returns(true) do while(percent_complete = Fog::Compute[:serverlove].images.get(@image['drive']).imaging) sleep(1) @@ -50,22 +50,22 @@ Shindo.tests('Fog::Compute[:serverlove] | server requests', ['serverlove']) do STDERR.print "100% " true end - + tests("#start_server").returns(true) do Fog::Compute[:serverlove].start_server(@server['server']) Fog::Compute[:serverlove].servers.get(@server['server']).status == "active" end - + tests("#reset_server").returns(true) do Fog::Compute[:serverlove].reset_server(@server['server']) Fog::Compute[:serverlove].servers.get(@server['server']).status == "active" end - + tests("#shutdown_server").succeeds do Fog::Compute[:serverlove].shutdown_server(@server['server']) # Can't guarantee the OS will honour this command so don't test status end - + tests("#stop_server").returns(true) do Fog::Compute[:serverlove].start_server(@server['server']) Fog::Compute[:serverlove].stop_server(@server['server']) @@ -75,7 +75,7 @@ Shindo.tests('Fog::Compute[:serverlove] | server requests', ['serverlove']) do tests("#destroy_server").succeeds do Fog::Compute[:serverlove].destroy_server(@server['server']) end - + tests("destroy test drive").succeeds do Fog::Compute[:serverlove].destroy_image(@image['drive']) end diff --git a/tests/serverlove/util/compute/password_generator_tests.rb b/tests/serverlove/util/compute/password_generator_tests.rb index 4650f7c13..07c0c1675 100644 --- a/tests/serverlove/util/compute/password_generator_tests.rb +++ b/tests/serverlove/util/compute/password_generator_tests.rb @@ -7,13 +7,13 @@ Shindo.tests('Fog::Compute::Serverlove::PasswordGenerator | generate password', tests("@password.length").returns(8) do @password.length end - + tests("@password contains one capital letter").returns(true) do @password.match(/[A-Z]/) && true end - + tests("@password contains one lower case letter").returns(true) do @password.match(/[a-z]/) && true end - + end diff --git a/tests/storm_on_demand/requests/compute/server_tests.rb b/tests/storm_on_demand/requests/compute/server_tests.rb index 826ed624f..072c6244c 100644 --- a/tests/storm_on_demand/requests/compute/server_tests.rb +++ b/tests/storm_on_demand/requests/compute/server_tests.rb @@ -21,11 +21,11 @@ Shindo.tests('Fog::Compute[:stormondemand] | server requests', ['stormondemand'] 'active' => Integer, 'create_date' => String } - + @servers_format = { 'items' => [@server_format] } - + tests('success') do @uniq_id = nil diff --git a/tests/vcloud/models/compute/network_tests.rb b/tests/vcloud/models/compute/network_tests.rb index d15ffa913..f27518274 100644 --- a/tests/vcloud/models/compute/network_tests.rb +++ b/tests/vcloud/models/compute/network_tests.rb @@ -15,17 +15,17 @@ Shindo.tests("Vcloud::Compute | network", ['vcloud']) do tests("an org network") do instance = connection.get_network("https://vcloud.example.com/api#{version == '1.0' ? '/v1.0' : ''}/network/1") instance.reload - + tests("#href").returns("https://vcloud.example.com/api#{version == '1.0' ? '/v1.0' : ''}/network/1") { instance.href } tests("#name").returns("Network1") { instance.name } tests("#description").returns("Some fancy Network") { instance.description } - + tests("configuration") do tests("parent network").returns("ParentNetwork1") { instance.configuration[:ParentNetwork][:name]} tests("dns").returns("172.0.0.2") { instance.configuration[:IpScope][:Dns1]} - + tests("#fence_mode").returns("natRouted") { instance.configuration[:FenceMode] } - + tests("features") do tests("dhcp_service") do tests("#is_enabled").returns("false") { instance.configuration[:Features][:DhcpService][:IsEnabled] } @@ -41,12 +41,12 @@ Shindo.tests("Vcloud::Compute | network", ['vcloud']) do end end end - + tests("#parent_network") do tests("returned network name").returns("ParentNetwork1"){ p = instance.parent_network; p.name } end end - + tests("an external network") do instance = connection.get_network("https://vcloud.example.com/api#{version == '1.0' ? '/v1.0' : ''}/admin/network/2") instance.reload @@ -54,12 +54,12 @@ Shindo.tests("Vcloud::Compute | network", ['vcloud']) do tests("#name").returns("ParentNetwork1") { instance.name } tests("#description").returns("Internet Connection") { instance.description } tests("#provider_info").returns("NETWORK:dvportgroup-230 on com.vmware.vcloud.entity.vimserver:35935555") { instance.provider_info } - + tests("configuration") do tests("dns").returns("172.0.0.2") { instance.configuration[:IpScope][:Dns1]} tests("allocated addresses").returns("172.0.0.144") { instance.configuration[:IpScope][:AllocatedIpAddresses][:IpAddress].first } end - + tests("#parent_network").returns(nil){ instance.parent_network } end end diff --git a/tests/vcloud/models/compute/networks_tests.rb b/tests/vcloud/models/compute/networks_tests.rb index f83ea8708..8032efb7b 100644 --- a/tests/vcloud/models/compute/networks_tests.rb +++ b/tests/vcloud/models/compute/networks_tests.rb @@ -16,13 +16,13 @@ Shindo.tests("Vcloud::Compute | networks", ['vcloud']) do ), :href => "https://vcloud.example.com/api#{version == '1.0' ? '/v1.0' : ''}/org/1" ) - + tests("collection") do returns(2) { instance.size } returns("https://vcloud.example.com/api#{version == '1.0' ? '/v1.0' : ''}/network/1") { instance.first.href } end end - + tests("from a vdc perspective") do instance = Fog::Vcloud::Compute::Networks.new( :connection => Fog::Vcloud::Compute.new( @@ -33,13 +33,13 @@ Shindo.tests("Vcloud::Compute | networks", ['vcloud']) do ), :href => "https://vcloud.example.com/api#{version == '1.0' ? '/v1.0' : ''}/vdc/1" ) - + tests("collection") do returns(2) { instance.size } returns("https://vcloud.example.com/api#{version == '1.0' ? '/v1.0' : ''}/network/1") { instance.first.href } end end - + tests("from a vapp perspective") do instance = Fog::Vcloud::Compute::Networks.new( :connection => Fog::Vcloud::Compute.new( @@ -50,7 +50,7 @@ Shindo.tests("Vcloud::Compute | networks", ['vcloud']) do ), :href => "https://vcloud.example.com/api#{version == '1.0' ? '/v1.0' : ''}/vApp/vapp-1" ) - + tests("collection") do returns(1) { instance.size } returns("https://vcloud.example.com/api#{version == '1.0' ? '/v1.0' : ''}/network/1") { instance.first.href } diff --git a/tests/vcloud/models/compute/organization_tests.rb b/tests/vcloud/models/compute/organization_tests.rb index 8d485c6c8..4c62648c6 100644 --- a/tests/vcloud/models/compute/organization_tests.rb +++ b/tests/vcloud/models/compute/organization_tests.rb @@ -10,7 +10,7 @@ Shindo.tests("Vcloud::Compute | organization", ['vcloud']) do :vcloud_version => version ).get_organization("https://vcloud.example.com/api#{(version == '1.0') ? '/v1.0' : ''}/org/1") instance.reload - + tests("#href").returns("https://vcloud.example.com/api#{(version == '1.0') ? '/v1.0' : ''}/org/1"){ instance.href } tests("#name").returns('Org1'){ instance.name } tests("#full_name").returns('My Full Name'){ instance.full_name } diff --git a/tests/vcloud/models/compute/organizations_tests.rb b/tests/vcloud/models/compute/organizations_tests.rb index 62a6ac9b8..92f676e72 100644 --- a/tests/vcloud/models/compute/organizations_tests.rb +++ b/tests/vcloud/models/compute/organizations_tests.rb @@ -6,7 +6,7 @@ Shindo.tests("Vcloud::Compute | organizations", ['vcloud']) do tests("api version #{version}") do pending if Fog.mocking? instance = Fog::Vcloud::Compute.new(:vcloud_host => 'vcloud.example.com', :vcloud_username => 'username', :vcloud_password => 'password', :vcloud_version => version).organizations - + tests("collection") do returns(2) { instance.size } returns("https://vcloud.example.com/api#{(version == '1.0') ? '/v1.0' : ''}/org/1") { instance.first.href } diff --git a/tests/vcloud/models/compute/server_tests.rb b/tests/vcloud/models/compute/server_tests.rb index a20354ccb..a3ddd5adf 100644 --- a/tests/vcloud/models/compute/server_tests.rb +++ b/tests/vcloud/models/compute/server_tests.rb @@ -11,24 +11,24 @@ Shindo.tests("Vcloud::Compute | server", ['vcloud']) do :vcloud_password => 'password', :vcloud_version => version ).get_server("https://vcloud.example.com/api#{(version == '1.0') ? '/v1.0' : ''}/vApp/vm-2") - + instance.reload - + tests("#href").returns("https://vcloud.example.com/api#{(version == '1.0') ? '/v1.0' : ''}/vApp/vm-2") { instance.href } tests("#name").returns("vm2") { instance.name } tests("#vapp").returns("vApp1") { instance.vapp.name } tests("#description").returns("Some VM Description") { instance.description } tests("#status").returns('8') { instance.status } tests("#deployed").returns(true) { instance.deployed } - + tests("#os_desc").returns("Red Hat Enterprise Linux 5 (64-bit)") { instance.os_desc } tests("#os_type").returns("rhel5_64Guest") { instance.os_type } tests("#computer_name").returns("vm2") { instance.computer_name } - + tests("cpu count").returns(1) { instance.cpus[:count] } - + tests("amount of memory").returns(512){ instance.memory[:amount] } - + tests("#disks") do tests("#size").returns(2){ instance.disks.size } tests("#number").returns(0){ instance.disks.first[:number] } @@ -36,13 +36,13 @@ Shindo.tests("Vcloud::Compute | server", ['vcloud']) do tests("#ElementName").returns("Hard disk 1"){ instance.disks.first[:disk_data][:'rasd:ElementName'] } tests("#InstanceID").returns("2000"){ instance.disks.first[:disk_data][:'rasd:InstanceID'] } end - + tests("#vapp_scoped_local_id").returns("vmware_RHEL5-U5-64-small_v02") { instance.vapp_scoped_local_id } - + tests("#friendly_status").returns('off') { instance.friendly_status } tests("#on?").returns(false) { instance.on? } tests("#off?").returns(true) { instance.off? } - + tests("#network_connections") do tests("#size").returns(2) { instance.network_connections.size } end diff --git a/tests/vcloud/models/compute/servers_tests.rb b/tests/vcloud/models/compute/servers_tests.rb index 8fa6e50c7..b0bde0f74 100644 --- a/tests/vcloud/models/compute/servers_tests.rb +++ b/tests/vcloud/models/compute/servers_tests.rb @@ -13,7 +13,7 @@ Shindo.tests("Vcloud::Compute | servers", ['vcloud']) do :vcloud_version => version), :href => "https://vcloud.example.com/api#{(version == '1.0') ? '/v1.0' : ''}/vApp/vapp-1" ) - + tests("collection") do returns(2) { instance.size } returns("https://vcloud.example.com/api#{(version == '1.0') ? '/v1.0' : ''}/vApp/vm-2") { instance.first.href } diff --git a/tests/vcloud/models/compute/vapp_tests.rb b/tests/vcloud/models/compute/vapp_tests.rb index 905c92a3f..aae460c0e 100644 --- a/tests/vcloud/models/compute/vapp_tests.rb +++ b/tests/vcloud/models/compute/vapp_tests.rb @@ -13,17 +13,17 @@ Shindo.tests("Vcloud::Compute | vapp", ['vcloud']) do :vcloud_version => version ).get_vapp("https://vcloud.example.com/api#{(version == '1.0') ? '/v1.0' : ''}/vApp/vapp-1") instance.reload - + tests("#href").returns("https://vcloud.example.com/api#{(version == '1.0') ? '/v1.0' : ''}/vApp/vapp-1") { instance.href } tests("#name").returns("vApp1") { instance.name } tests("#vdc").returns("vDC1"){ instance.vdc.name } tests("#description").returns("Some Description of a vApp") { instance.description } tests("#status").returns('8') { instance.status } tests("#deployed").returns(true) { instance.deployed } - + tests("#children").returns(2) { instance.children.size } tests("#servers").returns(2) { instance.servers.size } - + tests("#friendly_status").returns('off') { instance.friendly_status } tests("#on?").returns(false) { instance.on? } tests("#off?").returns(true) { instance.off? } diff --git a/tests/vcloud/models/compute/vapps_tests.rb b/tests/vcloud/models/compute/vapps_tests.rb index b545a32fd..1f711afb1 100644 --- a/tests/vcloud/models/compute/vapps_tests.rb +++ b/tests/vcloud/models/compute/vapps_tests.rb @@ -9,7 +9,7 @@ Shindo.tests("Vcloud::Compute | vapps", ['vcloud']) do :connection => Fog::Vcloud::Compute.new(:vcloud_host => 'vcloud.example.com', :vcloud_username => 'username', :vcloud_password => 'password'), :href => "https://vcloud.example.com/api#{(version == '1.0') ? '/v1.0' : ''}/vdc/1" ) - + tests("collection") do returns(2) { instance.size } returns("https://vcloud.example.com/api#{(version == '1.0') ? '/v1.0' : ''}/vApp/vapp-1") { instance.first.href } diff --git a/tests/vcloud/models/compute/vdc_tests.rb b/tests/vcloud/models/compute/vdc_tests.rb index 79e1f8738..b533bd59a 100644 --- a/tests/vcloud/models/compute/vdc_tests.rb +++ b/tests/vcloud/models/compute/vdc_tests.rb @@ -12,9 +12,9 @@ Shindo.tests("Vcloud::Compute | vdc", ['vcloud']) do :vcloud_password => 'password', :vcloud_version => version ).get_vdc("https://vcloud.example.com/api#{(version == '1.0') ? '/v1.0' : ''}/vdc/1") - + instance.reload - + tests("#href").returns("https://vcloud.example.com/api#{(version == '1.0') ? '/v1.0' : ''}/vdc/1") { instance.href } tests("#name").returns("vDC1") { instance.name } tests('#organization').returns("Org1") { instance.organization.name } @@ -23,16 +23,16 @@ Shindo.tests("Vcloud::Compute | vdc", ['vcloud']) do tests("#nic_quota").returns(10) { instance.nic_quota } tests("#vm_quota").returns(10) { instance.vm_quota } tests("#is_enabled").returns(true) { instance.is_enabled } - + tests("#available_networks") do tests("#size").returns(2) { instance.available_networks.size } end - + tests("#storage_capacity") do tests("units").returns("MB") { instance.storage_capacity[:Units] } tests("allocated").returns("10240") { instance.storage_capacity[:Allocated] } end - + tests("#compute_capacity") do tests("cpu") do tests("allocated").returns("20000") { instance.compute_capacity[:Cpu][:Allocated] } diff --git a/tests/vcloud/models/compute/vdcs_tests.rb b/tests/vcloud/models/compute/vdcs_tests.rb index dccae36dd..4ddc3d8db 100644 --- a/tests/vcloud/models/compute/vdcs_tests.rb +++ b/tests/vcloud/models/compute/vdcs_tests.rb @@ -14,7 +14,7 @@ Shindo.tests("Vcloud::Compute | vdcs", ['vcloud']) do :vcloud_version => version), :href => "https://vcloud.example.com/api#{(version == '1.0') ? '/v1.0' : ''}/org/1" ) - + tests("collection") do returns(1) { instance.size } returns("https://vcloud.example.com/api#{(version == '1.0') ? '/v1.0' : ''}/vdc/1") { instance.first.href } diff --git a/tests/vcloud/requests/compute/disk_configure_tests.rb b/tests/vcloud/requests/compute/disk_configure_tests.rb index 7013add4b..aba3301ef 100644 --- a/tests/vcloud/requests/compute/disk_configure_tests.rb +++ b/tests/vcloud/requests/compute/disk_configure_tests.rb @@ -104,7 +104,7 @@ EOF ng.xpath("//xmlns:ResourceType[ .='17']", @xmlns).size == 2 ] end - + unless Fog.mocking? Vcloud[:compute].unstub!(:request) end diff --git a/tests/vcloud_director/requests/compute/edge_gateway_tests.rb b/tests/vcloud_director/requests/compute/edge_gateway_tests.rb index 64c808e72..6736a4e52 100644 --- a/tests/vcloud_director/requests/compute/edge_gateway_tests.rb +++ b/tests/vcloud_director/requests/compute/edge_gateway_tests.rb @@ -38,7 +38,7 @@ Shindo.tests('Compute::VcloudDirector | edge gateway requests', ['vclouddirector if l[:type] == 'application/vnd.vmware.vcloud.vdc+xml' id = l[:href].split('/').last edge_gateways = @service.get_org_vdc_gateways(id).body - if edge_gateways && edge_gateways[:EdgeGatewayRecord].size >= 1 + if edge_gateways && edge_gateways[:EdgeGatewayRecord].size >= 1 @vdc_id = id break end diff --git a/tests/vcloud_director/requests/compute/query_tests.rb b/tests/vcloud_director/requests/compute/query_tests.rb index c9a9a10c8..dc25714ba 100644 --- a/tests/vcloud_director/requests/compute/query_tests.rb +++ b/tests/vcloud_director/requests/compute/query_tests.rb @@ -11,7 +11,7 @@ Shindo.tests('Compute::VcloudDirector | query requests', ['vclouddirector']) do end end - # for each queriable type, query and check that each available format + # for each queriable type, query and check that each available format # returns a result that matches the base schema # @query_list[:Link].select do |link| @@ -91,7 +91,7 @@ Shindo.tests('Compute::VcloudDirector | query requests', ['vclouddirector']) do tests('fields option raises MockNotImplemented').raises(Fog::Errors::MockNotImplemented) do @service.get_execute_query('orgVdcNetwork', :fields => 'name,thing') end - end + end end end end diff --git a/tests/vsphere/requests/compute/vm_migrate_tests.rb b/tests/vsphere/requests/compute/vm_migrate_tests.rb index 252642506..fa6624480 100644 --- a/tests/vsphere/requests/compute/vm_migrate_tests.rb +++ b/tests/vsphere/requests/compute/vm_migrate_tests.rb @@ -9,7 +9,7 @@ Shindo.tests('Fog::Compute[:vsphere] | vm_migrate request', ['vsphere']) do test('be a kind of Hash') { response.kind_of? Hash } test('should have a task_state key') { response.has_key? 'task_state' } end - + tests('The expected options') do raises(ArgumentError, 'raises ArgumentError when instance_uuid option is missing') { compute.vm_migrate } end diff --git a/tests/xenserver/helper.rb b/tests/xenserver/helper.rb index 47447902b..f5aaa027d 100644 --- a/tests/xenserver/helper.rb +++ b/tests/xenserver/helper.rb @@ -12,7 +12,7 @@ def valid_ref?(ref) end def create_ephemeral_vm - Fog::Compute[:xenserver].servers.create(:name => test_ephemeral_vm_name, + Fog::Compute[:xenserver].servers.create(:name => test_ephemeral_vm_name, :template_name => test_template_name) end diff --git a/tests/xenserver/models/compute/host_cpu_tests.rb b/tests/xenserver/models/compute/host_cpu_tests.rb index b9bcdd4e4..48d59264c 100644 --- a/tests/xenserver/models/compute/host_cpu_tests.rb +++ b/tests/xenserver/models/compute/host_cpu_tests.rb @@ -6,7 +6,7 @@ Shindo.tests('Fog::Compute[:xenserver] | HostCpu model', ['xenserver']) do tests('The HostCpu model should') do tests('have attributes') do model_attribute_hash = host_cpu.attributes - attributes = [ + attributes = [ :reference, :uuid, :family, @@ -40,15 +40,15 @@ Shindo.tests('Fog::Compute[:xenserver] | HostCpu model', ['xenserver']) do test("return a valid host") do host_cpu.host.kind_of? Fog::Compute::XenServer::Host end - + test("have a valid vendor string") do host_cpu.vendor.kind_of? String end - + test("have a valid other_config") do host_cpu.other_config.kind_of? Hash end - + test("have a valid utilisation attribute") do host_cpu.utilisation.kind_of? Float end diff --git a/tests/xenserver/models/compute/host_metrics_tests.rb b/tests/xenserver/models/compute/host_metrics_tests.rb index 4ac39de30..183efe66d 100644 --- a/tests/xenserver/models/compute/host_metrics_tests.rb +++ b/tests/xenserver/models/compute/host_metrics_tests.rb @@ -5,7 +5,7 @@ Shindo.tests('Fog::Compute[:xenserver] | HostMetrics model', ['xenserver']) do tests('The HostMetrics model should') do tests('have attributes') do model_attribute_hash = host.metrics.attributes - attributes = [ + attributes = [ :reference, :uuid, :memory_free, @@ -30,17 +30,17 @@ Shindo.tests('Fog::Compute[:xenserver] | HostMetrics model', ['xenserver']) do end test("have a last_updated Time property") { host.metrics.last_updated.kind_of? Time } - - test("return a valid memory_free ammount") do - (host.metrics.memory_free =~ /^\d+$/) == 0 + + test("return a valid memory_free ammount") do + (host.metrics.memory_free =~ /^\d+$/) == 0 end test("have memory_free > 0") { host.metrics.memory_free.to_i > 0 } - + test("return a valid memory_total ammount") do - (host.metrics.memory_total =~ /^\d+$/) == 0 + (host.metrics.memory_total =~ /^\d+$/) == 0 end - + test("have memory_total > 0") { host.metrics.memory_total.to_i > 0 } end diff --git a/tests/xenserver/models/compute/host_tests.rb b/tests/xenserver/models/compute/host_tests.rb index cde827d20..da77a945d 100644 --- a/tests/xenserver/models/compute/host_tests.rb +++ b/tests/xenserver/models/compute/host_tests.rb @@ -2,7 +2,7 @@ Shindo.tests('Fog::Compute[:xenserver] | host model', ['xenserver']) do hosts = Fog::Compute[:xenserver].hosts - host = hosts.first + host = hosts.first tests('The host model should') do tests('have the action') do @@ -14,7 +14,7 @@ Shindo.tests('Fog::Compute[:xenserver] | host model', ['xenserver']) do tests('have attributes') do model_attribute_hash = host.attributes - attributes = [ + attributes = [ :reference, :uuid, :name, @@ -51,21 +51,21 @@ Shindo.tests('Fog::Compute[:xenserver] | host model', ['xenserver']) do tests("A real host should") do tests("return valid PIFs") do test("as an array") { host.pifs.kind_of? Array } - host.pifs.each { |i| + host.pifs.each { |i| test("and each PIF should be a Fog::Compute::XenServer::PIF") { i.kind_of? Fog::Compute::XenServer::PIF} - } + } end tests("return valid PBDs") do test("as an array") { host.pbds.kind_of? Array } - host.pbds.each { |i| + host.pbds.each { |i| test("and each PBD should be a Fog::Compute::XenServer::PBD") { i.kind_of? Fog::Compute::XenServer::PBD} - } + } end tests("return valid resident servers") do test("as an array") { host.resident_servers.kind_of? Array } - host.resident_servers.each { |i| + host.resident_servers.each { |i| test("and each Server should be a Fog::Compute::XenServer::Server") { i.kind_of? Fog::Compute::XenServer::Server} - } + } end tests("return valid HostMetrics") do test("object") { host.metrics.kind_of? Fog::Compute::XenServer::HostMetrics } @@ -86,13 +86,13 @@ Shindo.tests('Fog::Compute[:xenserver] | host model', ['xenserver']) do tests('return a list of HostCpu') do test('as an Array') do - host.host_cpus.kind_of? Array + host.host_cpus.kind_of? Array end test('with one element at least') do host.host_cpus.first.kind_of? Fog::Compute::XenServer::HostCpu end end - + end end diff --git a/tests/xenserver/models/compute/hosts_tests.rb b/tests/xenserver/models/compute/hosts_tests.rb index aacada156..686698d1b 100644 --- a/tests/xenserver/models/compute/hosts_tests.rb +++ b/tests/xenserver/models/compute/hosts_tests.rb @@ -1,7 +1,7 @@ Shindo.tests('Fog::Compute[:xenserver] | hosts collection', ['xenserver']) do conn = Fog::Compute[:xenserver] - + tests('The hosts collection') do hosts = conn.hosts.all @@ -12,7 +12,7 @@ Shindo.tests('Fog::Compute[:xenserver] | hosts collection', ['xenserver']) do tests('should be able to reload itself').succeeds { hosts.reload } tests('should be able to get a model') do - tests('by reference').succeeds { + tests('by reference').succeeds { hosts.get(hosts.first.reference).is_a? Fog::Compute::XenServer::Host } end diff --git a/tests/xenserver/models/compute/network_tests.rb b/tests/xenserver/models/compute/network_tests.rb index 979f4907a..a75d2694e 100644 --- a/tests/xenserver/models/compute/network_tests.rb +++ b/tests/xenserver/models/compute/network_tests.rb @@ -12,7 +12,7 @@ Shindo.tests('Fog::Compute[:network] | network model', ['xenserver']) do end tests('have attributes') do model_attribute_hash = network.attributes - attributes = [ + attributes = [ :reference, :uuid, :__vifs, @@ -45,16 +45,16 @@ Shindo.tests('Fog::Compute[:network] | network model', ['xenserver']) do tests("A real network should") do tests("return valid vifs") do test("as an array") { network.vifs.kind_of? Array } - network.vifs.each { |i| + network.vifs.each { |i| test("and each VIF should be a Fog::Compute::XenServer::VIF") { i.kind_of? Fog::Compute::XenServer::VIF } - } + } end - tests("return valid PIFs") do + tests("return valid PIFs") do networks.each do |network| test("as an array") { network.pifs.kind_of? Array } - network.pifs.each { |i| + network.pifs.each { |i| test("and each PIF should be a Fog::Compute::XenServer::PIF") { i.kind_of? Fog::Compute::XenServer::PIF} - } + } end end diff --git a/tests/xenserver/models/compute/networks_tests.rb b/tests/xenserver/models/compute/networks_tests.rb index de0083628..ed773472f 100644 --- a/tests/xenserver/models/compute/networks_tests.rb +++ b/tests/xenserver/models/compute/networks_tests.rb @@ -1,7 +1,7 @@ Shindo.tests('Fog::Compute[:xenserver] | Networks collection', ['xenserver']) do conn = Fog::Compute[:xenserver] - + tests('The networks collection') do networks = conn.networks.all @@ -12,7 +12,7 @@ Shindo.tests('Fog::Compute[:xenserver] | Networks collection', ['xenserver']) do tests('should be able to reload itself').succeeds { networks.reload } tests('should be able to get a model') do - tests('by reference').succeeds { + tests('by reference').succeeds { networks.get(networks.first.reference).is_a? Fog::Compute::XenServer::Network } end diff --git a/tests/xenserver/models/compute/pbd_tests.rb b/tests/xenserver/models/compute/pbd_tests.rb index 303f96e73..7443f4582 100644 --- a/tests/xenserver/models/compute/pbd_tests.rb +++ b/tests/xenserver/models/compute/pbd_tests.rb @@ -10,7 +10,7 @@ Shindo.tests('Fog::Compute[:xenserver] | PBD model', ['xenserver']) do end tests('have attributes') do model_attribute_hash = pbd.attributes - attributes = [ + attributes = [ :reference, :uuid, :__host, diff --git a/tests/xenserver/models/compute/pbds_tests.rb b/tests/xenserver/models/compute/pbds_tests.rb index 2d87f98ce..ba930821a 100644 --- a/tests/xenserver/models/compute/pbds_tests.rb +++ b/tests/xenserver/models/compute/pbds_tests.rb @@ -1,7 +1,7 @@ Shindo.tests('Fog::Compute[:xenserver] | pbds collection', ['xenserver']) do conn = Fog::Compute[:xenserver] - + tests('The pbds collection') do pbds = conn.pbds.all @@ -12,7 +12,7 @@ Shindo.tests('Fog::Compute[:xenserver] | pbds collection', ['xenserver']) do tests('should be able to reload itself').succeeds { pbds.reload } tests('should be able to get a model') do - tests('by reference').succeeds { + tests('by reference').succeeds { pbds.get(pbds.first.reference).is_a? Fog::Compute::XenServer::PBD } end diff --git a/tests/xenserver/models/compute/pif_tests.rb b/tests/xenserver/models/compute/pif_tests.rb index 3e6fbcedb..9b2a03abe 100644 --- a/tests/xenserver/models/compute/pif_tests.rb +++ b/tests/xenserver/models/compute/pif_tests.rb @@ -9,7 +9,7 @@ Shindo.tests('Fog::Compute[:xenserver] | PIF model', ['xenserver']) do end tests('have attributes') do model_attribute_hash = pif.attributes - attributes = [ + attributes = [ :reference, :uuid, :physical, diff --git a/tests/xenserver/models/compute/pifs_tests.rb b/tests/xenserver/models/compute/pifs_tests.rb index b5a301118..cabe9c2f4 100644 --- a/tests/xenserver/models/compute/pifs_tests.rb +++ b/tests/xenserver/models/compute/pifs_tests.rb @@ -1,7 +1,7 @@ Shindo.tests('Fog::Compute[:xenserver] | PIFs collection', ['xenserver']) do conn = Fog::Compute[:xenserver] - + tests('The pifs collection') do pifs = conn.pifs.all @@ -12,7 +12,7 @@ Shindo.tests('Fog::Compute[:xenserver] | PIFs collection', ['xenserver']) do tests('should be able to reload itself').succeeds { pifs.reload } tests('should be able to get a model') do - tests('by reference').succeeds { + tests('by reference').succeeds { pifs.get(pifs.first.reference).is_a? Fog::Compute::XenServer::PIF } end diff --git a/tests/xenserver/models/compute/pool_tests.rb b/tests/xenserver/models/compute/pool_tests.rb index 54e26e123..797e6834b 100644 --- a/tests/xenserver/models/compute/pool_tests.rb +++ b/tests/xenserver/models/compute/pool_tests.rb @@ -9,7 +9,7 @@ Shindo.tests('Fog::Compute[:xenserver] | Pool model', ['xenserver']) do end tests('have attributes') do model_attribute_hash = pool.attributes - attributes = [ + attributes = [ :reference, :uuid, :name, diff --git a/tests/xenserver/models/compute/pools_tests.rb b/tests/xenserver/models/compute/pools_tests.rb index f290630b3..06dab3a5b 100644 --- a/tests/xenserver/models/compute/pools_tests.rb +++ b/tests/xenserver/models/compute/pools_tests.rb @@ -1,7 +1,7 @@ Shindo.tests('Fog::Compute[:xenserver] | Pools collection', ['xenserver']) do conn = Fog::Compute[:xenserver] - + tests('The pools collection') do pools = conn.pools.all @@ -10,9 +10,9 @@ Shindo.tests('Fog::Compute[:xenserver] | Pools collection', ['xenserver']) do test('should be a kind of Fog::Compute::XenServer::Pools') { pools.kind_of? Fog::Compute::XenServer::Pools } tests('should be an array of Fog::Compute::XenServer::Pool') do - pools.each do |p| + pools.each do |p| test("#{p.uuid} is a Fog::Compute::XenServer::Pool") { - p.is_a? Fog::Compute::XenServer::Pool + p.is_a? Fog::Compute::XenServer::Pool } end end @@ -20,7 +20,7 @@ Shindo.tests('Fog::Compute[:xenserver] | Pools collection', ['xenserver']) do tests('should be able to reload itself').succeeds { pools.reload } tests('should be able to get a model') do - tests('by reference').succeeds { + tests('by reference').succeeds { pools.get(pools.first.reference).is_a? Fog::Compute::XenServer::Pool } end diff --git a/tests/xenserver/models/compute/servers_tests.rb b/tests/xenserver/models/compute/servers_tests.rb index b5980a763..c820ae9d2 100644 --- a/tests/xenserver/models/compute/servers_tests.rb +++ b/tests/xenserver/models/compute/servers_tests.rb @@ -4,19 +4,19 @@ Shindo.tests('Fog::Compute[:xenserver] | servers collection', ['xenserver']) do destroy_ephemeral_servers servers = conn.servers templates = conn.servers.templates - + tests('The servers collection') do servers = conn.servers.all test('should be empty') do - servers.empty? + servers.empty? end - server = conn.servers.create(:name => test_ephemeral_vm_name, + server = conn.servers.create(:name => test_ephemeral_vm_name, :template_name => test_template_name) test('should NOT be empty') do servers.reload - !servers.empty? + !servers.empty? end server.destroy @@ -46,14 +46,14 @@ Shindo.tests('Fog::Compute[:xenserver] | servers collection', ['xenserver']) do found = (s.name == test_template_name) end found - end + end test("NOT include a #{test_template_name} template in built-in templates") do found = false servers.builtin_templates.each do |s| found = (s.name != test_template_name) end found - end + end # This may fail in other test scenarios with more than one built-in template # present test("include only one custom template") { servers.custom_templates.size == 1 } @@ -73,7 +73,7 @@ Shindo.tests('Fog::Compute[:xenserver] | servers collection', ['xenserver']) do tests('should be able to reload itself').succeeds { servers.reload } tests('should be able to get a model') do - server = conn.servers.create(:name => test_ephemeral_vm_name, + server = conn.servers.create(:name => test_ephemeral_vm_name, :template_name => test_template_name) test('by name') { servers.get_by_name(test_ephemeral_vm_name).kind_of? Fog::Compute::XenServer::Server } test('by instance uuid') { servers.get_by_uuid(server.uuid).kind_of? Fog::Compute::XenServer::Server } diff --git a/tests/xenserver/models/compute/storage_repositories_tests.rb b/tests/xenserver/models/compute/storage_repositories_tests.rb index 16b2c426b..41b4ca390 100644 --- a/tests/xenserver/models/compute/storage_repositories_tests.rb +++ b/tests/xenserver/models/compute/storage_repositories_tests.rb @@ -1,7 +1,7 @@ Shindo.tests('Fog::Compute[:xenserver] | StorageRepositories collection', ['xenserver']) do conn = Fog::Compute[:xenserver] - + tests('The storage_repositories collection') do storage_repositories = conn.storage_repositories.all @@ -10,9 +10,9 @@ Shindo.tests('Fog::Compute[:xenserver] | StorageRepositories collection', ['xens test('should be a kind of Fog::Compute::XenServer::StorageRepositories') { storage_repositories.kind_of? Fog::Compute::XenServer::StorageRepositories } tests('should be an array of Fog::Compute::XenServer::StorageRepository') do - storage_repositories.each do |p| + storage_repositories.each do |p| test("#{p.uuid} is a Fog::Compute::XenServer::StorageRepository") { - p.is_a? Fog::Compute::XenServer::StorageRepository + p.is_a? Fog::Compute::XenServer::StorageRepository } end end @@ -20,7 +20,7 @@ Shindo.tests('Fog::Compute[:xenserver] | StorageRepositories collection', ['xens tests('should be able to reload itself').succeeds { storage_repositories.reload } tests('should be able to get a model') do - tests('by reference').succeeds { + tests('by reference').succeeds { storage_repositories.get(storage_repositories.first.reference).is_a? Fog::Compute::XenServer::StorageRepository } end diff --git a/tests/xenserver/models/compute/storage_repository_tests.rb b/tests/xenserver/models/compute/storage_repository_tests.rb index cbe86ec70..005f53207 100644 --- a/tests/xenserver/models/compute/storage_repository_tests.rb +++ b/tests/xenserver/models/compute/storage_repository_tests.rb @@ -13,7 +13,7 @@ Shindo.tests('Fog::Compute[:xenserver] | StorageRepository model', ['xenserver'] end tests('have attributes') do model_attribute_hash = storage_repository.attributes - attributes = [ + attributes = [ :reference, :name, :uuid, @@ -51,14 +51,14 @@ Shindo.tests('Fog::Compute[:xenserver] | StorageRepository model', ['xenserver'] tests("A real StorageRepository should") do tests("return a valid list of VDIs") do - storage_repository.vdis.each do |vdi| + storage_repository.vdis.each do |vdi| test("where #{vdi.uuid} is a Fog::Compute::XenServer::VDI") { vdi.is_a? Fog::Compute::XenServer::VDI } end end tests("return a valid list of PBDs") do - storage_repository.pbds.each do |pbd| + storage_repository.pbds.each do |pbd| test("where #{pbd.uuid} is a Fog::Compute::XenServer::PBD") { pbd.is_a? Fog::Compute::XenServer::PBD } @@ -103,7 +103,7 @@ Shindo.tests('Fog::Compute[:xenserver] | StorageRepository model', ['xenserver'] end tests('#destroy should') do - test('destroy existing FOG TEST SR') do + test('destroy existing FOG TEST SR') do sr = (conn.storage_repositories.find { |sr| sr.name == 'FOG TEST SR' }) sr.pbds.each { |pbd| pbd.unplug } sr.destroy diff --git a/tests/xenserver/models/compute/vbd_tests.rb b/tests/xenserver/models/compute/vbd_tests.rb index aea94f626..d024ea47b 100644 --- a/tests/xenserver/models/compute/vbd_tests.rb +++ b/tests/xenserver/models/compute/vbd_tests.rb @@ -15,7 +15,7 @@ Shindo.tests('Fog::Compute[:xenserver] | VBD model', ['xenserver']) do end tests('have attributes') do model_attribute_hash = vbd.attributes - attributes = [ + attributes = [ :reference, :uuid, :currently_attached, @@ -53,7 +53,7 @@ Shindo.tests('Fog::Compute[:xenserver] | VBD model', ['xenserver']) do end tests("A real VBD should") do - test("have a valid OpaqueRef") do + test("have a valid OpaqueRef") do puts vbd.reference (vbd.reference =~ /OpaqueRef:/).eql?(0) and \ vbd.reference != "OpaqueRef:NULL" @@ -80,14 +80,14 @@ Shindo.tests('Fog::Compute[:xenserver] | VBD model', ['xenserver']) do end test("return a nil VDI when type CD") do if vbd.type == 'CD' - vbd.vdi.nil? + vbd.vdi.nil? else true end end test("return a VbdMetrics object when attached") do if vbd.currently_attached - vbd.metrics.kind_of? Fog::Compute::XenServer::VbdMetrics + vbd.metrics.kind_of? Fog::Compute::XenServer::VbdMetrics else vbd.metrics.nil? end @@ -111,5 +111,5 @@ Shindo.tests('Fog::Compute[:xenserver] | VBD model', ['xenserver']) do end destroy_ephemeral_servers - + end diff --git a/tests/xenserver/models/compute/vbds_tests.rb b/tests/xenserver/models/compute/vbds_tests.rb index 96798dd1f..da6036899 100644 --- a/tests/xenserver/models/compute/vbds_tests.rb +++ b/tests/xenserver/models/compute/vbds_tests.rb @@ -1,7 +1,7 @@ Shindo.tests('Fog::Compute[:xenserver] | VBDs collection', ['xenserver']) do conn = Fog::Compute[:xenserver] - + tests('The vbds collection') do vbds = conn.vbds.all @@ -12,7 +12,7 @@ Shindo.tests('Fog::Compute[:xenserver] | VBDs collection', ['xenserver']) do tests('should be able to reload itself').succeeds { vbds.reload } tests('should be able to get a model') do - tests('by reference').succeeds { + tests('by reference').succeeds { vbds.get(vbds.first.reference).is_a? Fog::Compute::XenServer::VBD } end diff --git a/tests/xenserver/models/compute/vif_tests.rb b/tests/xenserver/models/compute/vif_tests.rb index 3670e6554..15ff1143a 100644 --- a/tests/xenserver/models/compute/vif_tests.rb +++ b/tests/xenserver/models/compute/vif_tests.rb @@ -9,7 +9,7 @@ Shindo.tests('Fog::Compute[:xenserver] | VIF model', ['xenserver']) do end tests('have attributes') do model_attribute_hash = vif.attributes - attributes = [ + attributes = [ :reference, :mac, :uuid, diff --git a/tests/xenserver/models/compute/vifs_tests.rb b/tests/xenserver/models/compute/vifs_tests.rb index 69c0af665..2e7c8213b 100644 --- a/tests/xenserver/models/compute/vifs_tests.rb +++ b/tests/xenserver/models/compute/vifs_tests.rb @@ -1,7 +1,7 @@ Shindo.tests('Fog::Compute[:xenserver] | VIFs collection', ['xenserver']) do conn = Fog::Compute[:xenserver] - + tests('The vifs collection') do vifs = conn.vifs.all @@ -12,7 +12,7 @@ Shindo.tests('Fog::Compute[:xenserver] | VIFs collection', ['xenserver']) do tests('should be able to reload itself').succeeds { vifs.reload } tests('should be able to get a model') do - tests('by reference').succeeds { + tests('by reference').succeeds { vifs.get(vifs.first.reference).is_a? Fog::Compute::XenServer::VIF } end diff --git a/tests/xenserver/models/compute/vlan_tests.rb b/tests/xenserver/models/compute/vlan_tests.rb index 7b1e751f2..a41fe6042 100644 --- a/tests/xenserver/models/compute/vlan_tests.rb +++ b/tests/xenserver/models/compute/vlan_tests.rb @@ -12,7 +12,7 @@ Shindo.tests('Fog::Compute[:xenserver] | VLAN model', ['xenserver']) do end tests('have attributes') do model_attribute_hash = vlan.attributes - attributes = [ + attributes = [ :reference, :uuid, :__untagged_pif, @@ -60,7 +60,7 @@ Shindo.tests('Fog::Compute[:xenserver] | VLAN model', ['xenserver']) do (vlans.reload.find { |v| v.reference == @vlan.reference }).nil? end end - + tests("#tagged_pif") do test 'should return a PIF' do vlans.find.first.tagged_pif.is_a? Fog::Compute::XenServer::PIF diff --git a/tests/xenserver/models/compute/vlans_tests.rb b/tests/xenserver/models/compute/vlans_tests.rb index 3050693c7..adf1eab3e 100644 --- a/tests/xenserver/models/compute/vlans_tests.rb +++ b/tests/xenserver/models/compute/vlans_tests.rb @@ -1,19 +1,19 @@ Shindo.tests('Fog::Compute[:xenserver] | Vlans collection', ['xenserver']) do service = Fog::Compute[:xenserver] - + tests('The Vlans collection') do test('should not be empty') { !service.vlans.empty? } - test('should be a kind of Fog::Compute::XenServer::Vlans') do + test('should be a kind of Fog::Compute::XenServer::Vlans') do service.vlans.kind_of? Fog::Compute::XenServer::Vlans end tests('should be able to reload itself').succeeds { service.vlans.reload } tests('should be able to get a model') do - tests('by reference').succeeds { + tests('by reference').succeeds { service.vlans.get(service.vlans.first.reference).is_a? \ Fog::Compute::XenServer::VLAN } diff --git a/tests/xenserver/requests/compute/clone_server_tests.rb b/tests/xenserver/requests/compute/clone_server_tests.rb index 52c1329af..0868ac145 100644 --- a/tests/xenserver/requests/compute/clone_server_tests.rb +++ b/tests/xenserver/requests/compute/clone_server_tests.rb @@ -25,7 +25,7 @@ Shindo.tests('Fog::Compute[:xenserver] | clone_server request', ['xenserver']) d (ref =~ /OpaqueRef:/) == 0 and !(servers.custom_templates.find { |s| s.reference == ref }).nil? end end - + tests('The expected options') do raises(ArgumentError, 'raises ArgumentError when ref,class missing') { compute.clone_server } end diff --git a/tests/xenserver/requests/compute/create_network_tests.rb b/tests/xenserver/requests/compute/create_network_tests.rb index 6df753db1..9bc919307 100644 --- a/tests/xenserver/requests/compute/create_network_tests.rb +++ b/tests/xenserver/requests/compute/create_network_tests.rb @@ -16,5 +16,5 @@ Shindo.tests('Fog::Compute[:xenserver] | create_network request', ['xenserver']) end compute.destroy_network @ref - + end diff --git a/tests/xenserver/requests/compute/create_server_tests.rb b/tests/xenserver/requests/compute/create_server_tests.rb index 1192ac466..14ad41fe9 100644 --- a/tests/xenserver/requests/compute/create_server_tests.rb +++ b/tests/xenserver/requests/compute/create_server_tests.rb @@ -24,7 +24,7 @@ Shindo.tests('Fog::Compute[:xenserver] | create_server request', ['xenserver']) end end end - + tests('get_vm_by_name should') do test('return a valid OpaqueRef') do (compute.get_vm_by_name(test_template_name) =~ /OpaqueRef:/) and \ @@ -86,7 +86,7 @@ Shindo.tests('Fog::Compute[:xenserver] | create_server request', ['xenserver']) (compute.servers.get ref).vcpus_max == '1' end tests('set lowercase hash attributes') do - %w{ + %w{ VCPUs_params HVM_boot_params }.each do |a| @@ -100,10 +100,10 @@ Shindo.tests('Fog::Compute[:xenserver] | create_server request', ['xenserver']) ) eval "(compute.servers.get ref).#{a.to_s.downcase}['foo'] == 'bar'" end - end + end %w{ VCPUs_at_startup - VCPUs_max - PV_bootloader_args + VCPUs_max + PV_bootloader_args PV_bootloader PV_kernel PV_ramdisk @@ -119,7 +119,7 @@ Shindo.tests('Fog::Compute[:xenserver] | create_server request', ['xenserver']) ) eval "(compute.servers.get ref).#{a.to_s.downcase} == '1'" end - end + end end end diff --git a/tests/xenserver/requests/compute/create_sr_tests.rb b/tests/xenserver/requests/compute/create_sr_tests.rb index 18865d147..41c840501 100644 --- a/tests/xenserver/requests/compute/create_sr_tests.rb +++ b/tests/xenserver/requests/compute/create_sr_tests.rb @@ -11,7 +11,7 @@ Shindo.tests('Fog::Compute[:xenserver] | create_sr request', ['xenserver']) do compute = Fog::Compute[:xenserver] - + tests('#create_sr "FOG TEST SR" with device /dev/sdb') do test('create an EXT SR') do ref = compute.create_sr compute.hosts.first.reference, diff --git a/tests/xenserver/requests/compute/create_vdi_tests.rb b/tests/xenserver/requests/compute/create_vdi_tests.rb index f069aeec3..a3b251d12 100644 --- a/tests/xenserver/requests/compute/create_vdi_tests.rb +++ b/tests/xenserver/requests/compute/create_vdi_tests.rb @@ -2,54 +2,54 @@ Shindo.tests('Fog::Compute[:xenserver] | create_vdi request', ['xenserver']) do compute = Fog::Compute[:xenserver] sr = compute.storage_repositories.find { |sr| sr.name == 'Local storage' } - + tests('create_vdi should') do raises(ArgumentError, 'raise ArgumentError if virtual_size is no specified') do - ref = compute.create_vdi( { - :storage_repository => sr, + ref = compute.create_vdi( { + :storage_repository => sr, :name => 'foovdi', :type => 'system', :read_only => false, :sharable => false, - :other_config => {} + :other_config => {} } ) end raises(ArgumentError, 'raise ArgumentError if type is no specified') do - ref = compute.create_vdi( { - :storage_repository => sr, + ref = compute.create_vdi( { + :storage_repository => sr, :name => 'foovdi', :virtual_size => '8589934592', :read_only => false, :sharable => false, - :other_config => {} + :other_config => {} } ) valid_ref? ref end raises(ArgumentError, 'raise ArgumentError if read_only is no specified') do - ref = compute.create_vdi( { - :storage_repository => sr, + ref = compute.create_vdi( { + :storage_repository => sr, :name => 'foovdi', :virtual_size => '8589934592', :type => 'system', :sharable => false, - :other_config => {} + :other_config => {} } ) valid_ref? ref end raises(ArgumentError, 'raise ArgumentError if sharable is no specified') do - ref = compute.create_vdi( { - :storage_repository => sr, + ref = compute.create_vdi( { + :storage_repository => sr, :name => 'foovdi', :virtual_size => '8589934592', :type => 'system', :read_only => false, - :other_config => {} + :other_config => {} } ) valid_ref? ref end raises(ArgumentError, 'raise ArgumentError if other_config is no specified') do - ref = compute.create_vdi( { - :storage_repository => sr, + ref = compute.create_vdi( { + :storage_repository => sr, :name => 'foovdi', :virtual_size => '8589934592', :type => 'system', @@ -59,21 +59,21 @@ Shindo.tests('Fog::Compute[:xenserver] | create_vdi request', ['xenserver']) do valid_ref? ref end test('create a VDI') do - ref = compute.create_vdi( { - :storage_repository => sr, + ref = compute.create_vdi( { + :storage_repository => sr, :name => 'foovdi', :virtual_size => '8589934592', :type => 'system', :read_only => false, :sharable => false, - :other_config => {} + :other_config => {} } ) valid_ref? ref end end compute.vdis.each { |vdi| vdi.destroy if vdi.name == 'foovdi' } - + tests('The expected options') do raises(ArgumentError, 'raises ArgumentError when vm_ref,net_ref missing') { compute.create_vdi } end diff --git a/tests/xenserver/requests/compute/create_vif_tests.rb b/tests/xenserver/requests/compute/create_vif_tests.rb index 8b1d56a01..3edc4f6e1 100644 --- a/tests/xenserver/requests/compute/create_vif_tests.rb +++ b/tests/xenserver/requests/compute/create_vif_tests.rb @@ -6,7 +6,7 @@ Shindo.tests('Fog::Compute[:xenserver] | create_vif request', ['xenserver']) do (servers.all :name_matches => test_ephemeral_vm_name).each do |s| s.destroy end - + tests('create_vif should') do vm_ref = compute.create_server test_ephemeral_vm_name, test_template_name ref = compute.create_vif vm_ref, compute.networks.first.reference @@ -34,7 +34,7 @@ Shindo.tests('Fog::Compute[:xenserver] | create_vif request', ['xenserver']) do !(s.vifs.find { |vif| vif.reference == ref }).nil? end end - + tests('create_vif_custom should') do vm_ref = compute.create_server test_ephemeral_vm_name, test_template_name network_ref = compute.networks.first.reference @@ -81,7 +81,7 @@ Shindo.tests('Fog::Compute[:xenserver] | create_vif request', ['xenserver']) do vif.mac == '11:22:33:44:55:66' end end - + tests('The expected options') do raises(ArgumentError, 'raises ArgumentError when vm_ref,net_ref missing') { compute.create_vif } end diff --git a/tests/xenserver/requests/compute/create_vlan_tests.rb b/tests/xenserver/requests/compute/create_vlan_tests.rb index 23dd8f7f4..8ee4d5b8e 100644 --- a/tests/xenserver/requests/compute/create_vlan_tests.rb +++ b/tests/xenserver/requests/compute/create_vlan_tests.rb @@ -16,7 +16,7 @@ Shindo.tests('Fog::Compute[:xenserver] | create_vlan request', ['xenserver']) do @ref.start_with? "OpaqueRef" end end - + tests('failure') do test('#create_vlan duplicated') do raises = false @@ -32,5 +32,5 @@ Shindo.tests('Fog::Compute[:xenserver] | create_vlan request', ['xenserver']) do compute.destroy_vlan @ref @net.destroy - + end diff --git a/tests/xenserver/requests/compute/destroy_network_tests.rb b/tests/xenserver/requests/compute/destroy_network_tests.rb index d2ac39edf..293d2ee5f 100644 --- a/tests/xenserver/requests/compute/destroy_network_tests.rb +++ b/tests/xenserver/requests/compute/destroy_network_tests.rb @@ -9,5 +9,5 @@ Shindo.tests('Fog::Compute[:xenserver] | destroy_network request', ['xenserver'] (compute.networks.find { |n| n.reference == @ref }).nil? end end - + end diff --git a/tests/xenserver/requests/compute/destroy_sr_tests.rb b/tests/xenserver/requests/compute/destroy_sr_tests.rb index 0dc22c68b..37bdd4007 100644 --- a/tests/xenserver/requests/compute/destroy_sr_tests.rb +++ b/tests/xenserver/requests/compute/destroy_sr_tests.rb @@ -21,7 +21,7 @@ Shindo.tests('Fog::Compute[:xenserver] | destroy_sr request', ['xenserver']) do 'user', false, {} - + tests('#destroy_sr') do test('destroyed "FOG TEST SR"') do compute.storage_repositories.each do |sr| @@ -32,7 +32,7 @@ Shindo.tests('Fog::Compute[:xenserver] | destroy_sr request', ['xenserver']) do (compute.storage_repositories.find { |sr| sr.name == 'FOG TEST SR' }).nil? end - raises(Fog::XenServer::RequestFailed, + raises(Fog::XenServer::RequestFailed, 'raises HandleInvalid trying to destroy it twice') do compute.destroy_sr ref end diff --git a/tests/xenserver/requests/compute/destroy_vdi_tests.rb b/tests/xenserver/requests/compute/destroy_vdi_tests.rb index 901b94fda..1278fab8c 100644 --- a/tests/xenserver/requests/compute/destroy_vdi_tests.rb +++ b/tests/xenserver/requests/compute/destroy_vdi_tests.rb @@ -4,17 +4,17 @@ Shindo.tests('Fog::Compute[:xenserver] | destroy_vdi request', ['xenserver']) do sr = compute.storage_repositories.find { |sr| sr.name == 'Local storage' } tests('destroy_vdi should') do - ref = compute.create_vdi( { - :storage_repository => sr, + ref = compute.create_vdi( { + :storage_repository => sr, :name => 'foovdi', :virtual_size => '8589934592', :type => 'system', :read_only => false, :sharable => false, - :other_config => {} + :other_config => {} } ) raises(Fog::XenServer::RequestFailed, 'destroy it') do - compute.destroy_vdi ref + compute.destroy_vdi ref compute.vdis.get ref end end diff --git a/tests/xenserver/requests/compute/destroy_vlan_tests.rb b/tests/xenserver/requests/compute/destroy_vlan_tests.rb index ca3f9f469..3475c1b5d 100644 --- a/tests/xenserver/requests/compute/destroy_vlan_tests.rb +++ b/tests/xenserver/requests/compute/destroy_vlan_tests.rb @@ -17,7 +17,7 @@ Shindo.tests('Fog::Compute[:xenserver] | destroy_vlan request', ['xenserver']) d (compute.vlans.reload.find { |v| v.reference == @ref }).nil? end end - + tests('failure') do test('#destroy_vlan invalid') do raises = false @@ -32,5 +32,5 @@ Shindo.tests('Fog::Compute[:xenserver] | destroy_vlan request', ['xenserver']) d end @net.destroy - + end diff --git a/tests/xenserver/requests/compute/disable_host_tests.rb b/tests/xenserver/requests/compute/disable_host_tests.rb index 914d98d23..74e8133d8 100644 --- a/tests/xenserver/requests/compute/disable_host_tests.rb +++ b/tests/xenserver/requests/compute/disable_host_tests.rb @@ -2,7 +2,7 @@ Shindo.tests('Fog::Compute[:xenserver] | disable_host request', ['xenserver']) d compute = Fog::Compute[:xenserver] host = compute.hosts.first - + tests('#disable_host') do test('disables the host') do compute.disable_host host.reference @@ -11,6 +11,6 @@ Shindo.tests('Fog::Compute[:xenserver] | disable_host request', ['xenserver']) d end end - # Cleanup + # Cleanup host.enable end diff --git a/tests/xenserver/requests/compute/enable_host_tests.rb b/tests/xenserver/requests/compute/enable_host_tests.rb index aa6d6e470..26289ea70 100644 --- a/tests/xenserver/requests/compute/enable_host_tests.rb +++ b/tests/xenserver/requests/compute/enable_host_tests.rb @@ -2,7 +2,7 @@ Shindo.tests('Fog::Compute[:xenserver] | enable_host request', ['xenserver']) do compute = Fog::Compute[:xenserver] host = compute.hosts.first - + tests('#enable_host') do test('enables the host') do compute.enable_host host.reference @@ -11,6 +11,6 @@ Shindo.tests('Fog::Compute[:xenserver] | enable_host request', ['xenserver']) do end end - # Cleanup + # Cleanup host.enable end diff --git a/tests/xenserver/requests/compute/get_record_tests.rb b/tests/xenserver/requests/compute/get_record_tests.rb index d1797c453..e3ad40cca 100644 --- a/tests/xenserver/requests/compute/get_record_tests.rb +++ b/tests/xenserver/requests/compute/get_record_tests.rb @@ -8,7 +8,7 @@ Shindo.tests('Fog::Compute[:xenserver] | get_record request', ['xenserver']) do response = compute.get_record(vm_ref, 'VM') end end - + tests('The expected options') do raises(ArgumentError, 'raises ArgumentError when ref,class missing') { compute.get_record } end diff --git a/tests/xenserver/requests/compute/set_attribute_tests.rb b/tests/xenserver/requests/compute/set_attribute_tests.rb index 3d046fa3c..18bb9f1d4 100644 --- a/tests/xenserver/requests/compute/set_attribute_tests.rb +++ b/tests/xenserver/requests/compute/set_attribute_tests.rb @@ -28,8 +28,8 @@ Shindo.tests('Fog::Compute[:xenserver] | set_attribute request', ['xenserver']) server = create_ephemeral_server server.stop 'hard' server.wait_for { not running? } - response = connection.set_attribute('VM', - server.reference, + response = connection.set_attribute('VM', + server.reference, 'memory_limits', '1073741824', '1073741824', @@ -40,7 +40,7 @@ Shindo.tests('Fog::Compute[:xenserver] | set_attribute request', ['xenserver']) (server.memory_dynamic_max == "1073741824") and \ (server.memory_dynamic_min == "1073741824") and \ (server.memory_static_max == "1073741824") and \ - (server.memory_static_min == "1073741824") + (server.memory_static_min == "1073741824") server.start end diff --git a/tests/xenserver/requests/compute/unplug_pbd_tests.rb b/tests/xenserver/requests/compute/unplug_pbd_tests.rb index c0f4f5c92..fc9e4ef6b 100644 --- a/tests/xenserver/requests/compute/unplug_pbd_tests.rb +++ b/tests/xenserver/requests/compute/unplug_pbd_tests.rb @@ -22,7 +22,7 @@ Shindo.tests('Fog::Compute[:xenserver] | unplug_pbd request', ['xenserver']) do 'user', false, {} - + tests('#unplug_pbd') do test('unplugged') do sr = compute.storage_repositories.find { |sr| sr.name == 'FOG TEST SR' } @@ -37,7 +37,7 @@ Shindo.tests('Fog::Compute[:xenserver] | unplug_pbd request', ['xenserver']) do raises(ArgumentError, 'raises ArgumentError when arguments missing') \ { compute.unplug_pbd } end - + # Clean-up compute.storage_repositories.each do |sr| next unless sr.name == 'FOG TEST SR' diff --git a/tests/zerigo/requests/dns/dns_tests.rb b/tests/zerigo/requests/dns/dns_tests.rb index b012582ec..9789a7c04 100644 --- a/tests/zerigo/requests/dns/dns_tests.rb +++ b/tests/zerigo/requests/dns/dns_tests.rb @@ -10,7 +10,7 @@ Shindo.tests('Fog::DNS[:zerigo] | DNS requests', ['zerigo', 'dns']) do def generate_unique_domain( with_trailing_dot = false) #get time (with 1/100th of sec accuracy) #want unique domain name and if provider is fast, this can be called more than once per second - time= (Time.now.to_f * 100).to_i + time= (Time.now.to_f * 100).to_i domain = 'test-' + time.to_s + '.com' if with_trailing_dot domain+= '.' @@ -44,7 +44,7 @@ Shindo.tests('Fog::DNS[:zerigo] | DNS requests', ['zerigo', 'dns']) do #worked so can now delete response = Fog::DNS[:zerigo].delete_zone( zone_id) end - + response.status == 200 end @@ -59,7 +59,7 @@ Shindo.tests('Fog::DNS[:zerigo] | DNS requests', ['zerigo', 'dns']) do #worked so can now delete response = Fog::DNS[:zerigo].delete_zone( zone_id) end - + response.status == 200 end @@ -77,19 +77,19 @@ Shindo.tests('Fog::DNS[:zerigo] | DNS requests', ['zerigo', 'dns']) do response.status == 200 end - + test('create zone - set all parameters') do pending if Fog.mocking? @domain = generate_unique_domain - options = { :nx_ttl => 1800, :active => 'N', :hostmaster => "netops@#{@domain}", + options = { :nx_ttl => 1800, :active => 'N', :hostmaster => "netops@#{@domain}", :notes => 'for client ABC', :tag_list=> 'sample-tag' } response = Fog::DNS[:zerigo].create_zone( @domain, 14400, 'pri', options ) if response.status == 201 @zone_id = response.body['id'] @new_zones << @zone_id end - + response.status == 201 end @@ -97,14 +97,14 @@ Shindo.tests('Fog::DNS[:zerigo] | DNS requests', ['zerigo', 'dns']) do pending if Fog.mocking? result= false - + response = Fog::DNS[:zerigo].get_zone( @zone_id) if response.status == 200 zone = response.body - if (zone['ns-type'] == 'pri') and (zone['tag-list'] == 'sample-tag') and + if (zone['ns-type'] == 'pri') and (zone['tag-list'] == 'sample-tag') and (zone['default-ttl'] == 14400) and (zone['nx-ttl'] == 1800) and - (zone['updated-at'].length > 0) and (zone['created-at'].length > 0) and - (zone['domain'] == @domain) and (zone['notes'] == 'for client ABC') and + (zone['updated-at'].length > 0) and (zone['created-at'].length > 0) and + (zone['domain'] == @domain) and (zone['notes'] == 'for client ABC') and (zone['id'] == @zone_id) result = true end @@ -112,13 +112,13 @@ Shindo.tests('Fog::DNS[:zerigo] | DNS requests', ['zerigo', 'dns']) do result end end - + test("update zone #{@zone_id} - set notes & tags") do pending if Fog.mocking? - + options = { :notes => 'for client XYZ', :tag_list=> 'testing-tag' } response = Fog::DNS[:zerigo].update_zone( @zone_id, options ) - + response.status == 200 end @@ -126,23 +126,23 @@ Shindo.tests('Fog::DNS[:zerigo] | DNS requests', ['zerigo', 'dns']) do pending if Fog.mocking? result= false - + response = Fog::DNS[:zerigo].get_zone( @zone_id) if response.status == 200 zone = response.body - if (zone['tag-list'] == 'testing-tag') and (zone['notes'] == 'for client XYZ') + if (zone['tag-list'] == 'testing-tag') and (zone['notes'] == 'for client XYZ') result = true end result end end - - test("get zone stats for #{@zone_id}") do + + test("get zone stats for #{@zone_id}") do pending if Fog.mocking? result= false - + response = Fog::DNS[:zerigo].get_zone_stats( @zone_id) if response.status == 200 zone = response.body @@ -150,12 +150,12 @@ Shindo.tests('Fog::DNS[:zerigo] | DNS requests', ['zerigo', 'dns']) do (zone['period-begin'].length > 0) and (zone['period-end'].length > 0) result= true end - + result end end - + test("list zones - make sure total count is #{@org_zone_count+1}") do pending if Fog.mocking? @@ -171,17 +171,17 @@ Shindo.tests('Fog::DNS[:zerigo] | DNS requests', ['zerigo', 'dns']) do result end - + test('list zones with pagination') do pending if Fog.mocking? - + result = false - + # make enough zones to paginate number_zones_to_create = MAX_ZONE_COUNT-@org_zone_count-1 number_zones_to_create.times do |i| domain = generate_unique_domain - options = { :nx_ttl => 1800, :active => 'N', :hostmaster => "netops@#{domain}", + options = { :nx_ttl => 1800, :active => 'N', :hostmaster => "netops@#{domain}", :notes => 'for client ABC', :tag_list=> "sample-tag-#{i}" } response = Fog::DNS[:zerigo].create_zone( domain, 14400, 'pri', options ) if response.status == 201 @@ -209,15 +209,15 @@ Shindo.tests('Fog::DNS[:zerigo] | DNS requests', ['zerigo', 'dns']) do zones_we_should_see.delete(zones.first['id']) end end - + if zones_we_should_see.empty? result = true end end - + result end - + test('create record - simple A record') do pending if Fog.mocking? @@ -228,13 +228,13 @@ Shindo.tests('Fog::DNS[:zerigo] | DNS requests', ['zerigo', 'dns']) do record_id = response.body['id'] @new_records << record_id end - + response.status == 201 end - + test('create record - CNAME record') do pending if Fog.mocking? - + host = 'mail' options = { :hostname => host } response = Fog::DNS[:zerigo].create_host( @zone_id, 'CNAME', @domain, options) @@ -242,7 +242,7 @@ Shindo.tests('Fog::DNS[:zerigo] | DNS requests', ['zerigo', 'dns']) do record_id = response.body['id'] @new_records << record_id end - + response.status == 201 end @@ -260,7 +260,7 @@ Shindo.tests('Fog::DNS[:zerigo] | DNS requests', ['zerigo', 'dns']) do record_id = response.body['id'] @new_records << record_id end - + response.status == 201 end @@ -274,15 +274,15 @@ Shindo.tests('Fog::DNS[:zerigo] | DNS requests', ['zerigo', 'dns']) do @record_id = response.body['id'] @new_records << @record_id end - + response.status == 201 end - + test("get host #{@record_id}") do pending if Fog.mocking? result = false - + response = Fog::DNS[:zerigo].get_host( @record_id) if response.status == 200 host = response.body @@ -291,7 +291,7 @@ Shindo.tests('Fog::DNS[:zerigo] | DNS requests', ['zerigo', 'dns']) do result = true end end - + result end @@ -299,7 +299,7 @@ Shindo.tests('Fog::DNS[:zerigo] | DNS requests', ['zerigo', 'dns']) do pending if Fog.mocking? result = false - + options = { :priority => 7 } response = Fog::DNS[:zerigo].update_host( @record_id, options) if response.status == 200 @@ -311,7 +311,7 @@ Shindo.tests('Fog::DNS[:zerigo] | DNS requests', ['zerigo', 'dns']) do end end end - + result end @@ -323,7 +323,7 @@ Shindo.tests('Fog::DNS[:zerigo] | DNS requests', ['zerigo', 'dns']) do if response.status == 200 host_count = response.body['count'] end - + host_count == 4 end @@ -331,7 +331,7 @@ Shindo.tests('Fog::DNS[:zerigo] | DNS requests', ['zerigo', 'dns']) do pending if Fog.mocking? result = false - + response = Fog::DNS[:zerigo].list_hosts( @zone_id) if response.status == 200 hosts = response.body['hosts'] @@ -343,16 +343,16 @@ Shindo.tests('Fog::DNS[:zerigo] | DNS requests', ['zerigo', 'dns']) do end } end - end - + end + result end - + test("find host: mail.#{@domain}") do pending if Fog.mocking? result = false - + host = 'mail.' + @domain response = Fog::DNS[:zerigo].find_hosts( host) if response.status == 200 @@ -362,7 +362,7 @@ Shindo.tests('Fog::DNS[:zerigo] | DNS requests', ['zerigo', 'dns']) do result = true end end - + result end @@ -370,7 +370,7 @@ Shindo.tests('Fog::DNS[:zerigo] | DNS requests', ['zerigo', 'dns']) do pending if Fog.mocking? result = false - + host = 'mail.' + @domain response = Fog::DNS[:zerigo].find_hosts( host, @zone_id) if response.status == 200 @@ -380,7 +380,7 @@ Shindo.tests('Fog::DNS[:zerigo] | DNS requests', ['zerigo', 'dns']) do result = true end end - + result end @@ -410,10 +410,10 @@ Shindo.tests('Fog::DNS[:zerigo] | DNS requests', ['zerigo', 'dns']) do } result end - + end - + tests( 'failure') do end - + end