mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
parent
b1f39c09ba
commit
7b4a517cbf
42 changed files with 250 additions and 250 deletions
|
@ -1,6 +1,6 @@
|
|||
Shindo.tests('AWS::AutoScaling | activities', ['aws', 'auto_scaling_m']) do
|
||||
|
||||
pending # FIXME: activity#save is not implemented
|
||||
collection_tests(AWS[:auto_scaling].activities, {}, false)
|
||||
collection_tests(Fog::AWS[:auto_scaling].activities, {}, false)
|
||||
|
||||
end
|
||||
|
|
|
@ -6,7 +6,7 @@ Shindo.tests('AWS::AutoScaling | configuration', ['aws', 'auto_scaling_m']) do
|
|||
:instance_type => 't1.micro'
|
||||
}
|
||||
|
||||
model_tests(AWS[:auto_scaling].configurations, params, false) do
|
||||
model_tests(Fog::AWS[:auto_scaling].configurations, params, false) do
|
||||
@instance.wait_for { ready? }
|
||||
end
|
||||
|
||||
|
|
|
@ -6,6 +6,6 @@ Shindo.tests('AWS::AutoScaling | configurations', ['aws', 'auto_scaling_m']) do
|
|||
:instance_type => 't1.micro'
|
||||
}
|
||||
|
||||
collection_tests(AWS[:auto_scaling].configurations, params, false)
|
||||
collection_tests(Fog::AWS[:auto_scaling].configurations, params, false)
|
||||
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
Shindo.tests('AWS::AutoScaling | instances', ['aws', 'auto_scaling_m']) do
|
||||
|
||||
pending # FIXME: instance#save is not defined
|
||||
#collection_tests(AWS[:auto_scaling].instances, {}, false)
|
||||
#collection_tests(Fog::AWS[:auto_scaling].instances, {}, false)
|
||||
|
||||
end
|
||||
|
|
|
@ -12,7 +12,7 @@ Shindo.tests("AWS::CloudWatch | metric_statistics", ['aws', 'cloudwatch']) do
|
|||
statisticTypes = ['Minimum','Maximum','Sum','SampleCount','Average']
|
||||
|
||||
tests("#all").succeeds do
|
||||
@statistics = AWS[:cloud_watch].metric_statistics.all({'Statistics' => statisticTypes, 'StartTime' => startTime, 'EndTime' => endTime, 'Period' => period, 'MetricName' => metricName, 'Namespace' => namespace, 'Dimensions' => [{'Name' => 'InstanceId', 'Value' => instanceId}]})
|
||||
@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
|
||||
|
@ -26,11 +26,11 @@ Shindo.tests("AWS::CloudWatch | metric_statistics", ['aws', 'cloudwatch']) do
|
|||
:unit => 'None'
|
||||
}
|
||||
tests('#new').returns(new_attributes) do
|
||||
AWS[:cloud_watch].metric_statistics.new(new_attributes).attributes
|
||||
Fog::AWS[:cloud_watch].metric_statistics.new(new_attributes).attributes
|
||||
end
|
||||
|
||||
tests('#create').returns(new_attributes) do
|
||||
AWS[:cloud_watch].metric_statistics.create(new_attributes).attributes
|
||||
Fog::AWS[:cloud_watch].metric_statistics.create(new_attributes).attributes
|
||||
end
|
||||
|
||||
stats_set_attributes = {
|
||||
|
@ -44,7 +44,7 @@ Shindo.tests("AWS::CloudWatch | metric_statistics", ['aws', 'cloudwatch']) do
|
|||
:unit => 'None'
|
||||
}
|
||||
tests('#create_stats_set').returns(stats_set_attributes) do
|
||||
AWS[:cloud_watch].metric_statistics.create(stats_set_attributes).attributes
|
||||
Fog::AWS[:cloud_watch].metric_statistics.create(stats_set_attributes).attributes
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -3,13 +3,13 @@ Shindo.tests("AWS::CloudWatch | metrics", ['aws', 'cloudwatch']) do
|
|||
tests('success') do
|
||||
pending # FIXME: the hardcoded instance id won't be available
|
||||
tests("#all").succeeds do
|
||||
AWS[:cloud_watch].metrics.all
|
||||
Fog::AWS[:cloud_watch].metrics.all
|
||||
end
|
||||
instanceId = 'i-fd713391'
|
||||
metricName = 'CPUUtilization'
|
||||
namespace = 'AWS/EC2'
|
||||
tests("#get").returns({:dimensions=>[{"Name"=>"InstanceId", "Value"=>instanceId}], :name=>metricName, :namespace=>namespace}) do
|
||||
AWS[:cloud_watch].metrics.get(namespace, metricName, {'InstanceId' => instanceId}).attributes
|
||||
Fog::AWS[:cloud_watch].metrics.get(namespace, metricName, {'InstanceId' => instanceId}).attributes
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -5,13 +5,13 @@ Shindo.tests('AWS::ELB | models', ['aws', 'elb']) do
|
|||
tests('success') do
|
||||
tests('load_balancers') do
|
||||
tests('getting a missing elb') do
|
||||
returns(nil) { AWS[:elb].load_balancers.get('no-such-elb') }
|
||||
returns(nil) { Fog::AWS[:elb].load_balancers.get('no-such-elb') }
|
||||
end
|
||||
end
|
||||
|
||||
tests('listeners') do
|
||||
tests("default attributes") do
|
||||
listener = AWS[:elb].listeners.new
|
||||
listener = Fog::AWS[:elb].listeners.new
|
||||
tests('instance_port is 80').returns(80) { listener.instance_port }
|
||||
tests('lb_port is 80').returns(80) { listener.lb_port }
|
||||
tests('protocol is HTTP').returns('HTTP') { listener.protocol }
|
||||
|
@ -20,7 +20,7 @@ Shindo.tests('AWS::ELB | models', ['aws', 'elb']) do
|
|||
|
||||
tests("specifying attributes") do
|
||||
attributes = {:instance_port => 2000, :lb_port => 2001, :protocol => 'SSL', :policy_names => ['fake'] }
|
||||
listener = AWS[:elb].listeners.new(attributes)
|
||||
listener = Fog::AWS[:elb].listeners.new(attributes)
|
||||
tests('instance_port is 2000').returns(2000) { listener.instance_port }
|
||||
tests('lb_port is 2001').returns(2001) { listener.lb_port }
|
||||
tests('protocol is SSL').returns('SSL') { listener.protocol }
|
||||
|
@ -33,27 +33,27 @@ Shindo.tests('AWS::ELB | models', ['aws', 'elb']) do
|
|||
|
||||
tests('create') do
|
||||
tests('without availability zones') do
|
||||
elb = AWS[:elb].load_balancers.create(:id => elb_id)
|
||||
elb = Fog::AWS[:elb].load_balancers.create(:id => elb_id)
|
||||
tests("availability zones are correct").returns(@availability_zones.sort) { elb.availability_zones.sort }
|
||||
tests("dns names is set").returns(true) { elb.dns_name.is_a?(String) }
|
||||
tests("created_at is set").returns(true) { Time === elb.created_at }
|
||||
tests("policies is empty").returns([]) { elb.policies }
|
||||
tests("default listener") do
|
||||
tests("1 listener").returns(1) { elb.listeners.size }
|
||||
tests("params").returns(AWS[:elb].listeners.new.to_params) { elb.listeners.first.to_params }
|
||||
tests("params").returns(Fog::AWS[:elb].listeners.new.to_params) { elb.listeners.first.to_params }
|
||||
end
|
||||
end
|
||||
|
||||
tests('with availability zones') do
|
||||
azs = @availability_zones[1..-1]
|
||||
elb2 = AWS[:elb].load_balancers.create(:id => "#{elb_id}-2", :availability_zones => azs)
|
||||
elb2 = Fog::AWS[:elb].load_balancers.create(:id => "#{elb_id}-2", :availability_zones => azs)
|
||||
tests("availability zones are correct").returns(azs.sort) { elb2.availability_zones.sort }
|
||||
elb2.destroy
|
||||
end
|
||||
|
||||
# Need to sleep here for IAM changes to propgate
|
||||
tests('with ListenerDescriptions') do
|
||||
@certificate = AWS[:iam].upload_server_certificate(AWS::IAM::SERVER_CERT_PUBLIC_KEY, AWS::IAM::SERVER_CERT_PRIVATE_KEY, @key_name).body['Certificate']
|
||||
@certificate = Fog::AWS[:iam].upload_server_certificate(AWS::IAM::SERVER_CERT_PUBLIC_KEY, AWS::IAM::SERVER_CERT_PRIVATE_KEY, @key_name).body['Certificate']
|
||||
sleep(8) unless Fog.mocking?
|
||||
listeners = [{
|
||||
'Listener' => {
|
||||
|
@ -67,7 +67,7 @@ Shindo.tests('AWS::ELB | models', ['aws', 'elb']) do
|
|||
},
|
||||
'PolicyNames' => []
|
||||
}]
|
||||
elb3 = AWS[:elb].load_balancers.create(:id => "#{elb_id}-3", 'ListenerDescriptions' => listeners)
|
||||
elb3 = Fog::AWS[:elb].load_balancers.create(:id => "#{elb_id}-3", 'ListenerDescriptions' => listeners)
|
||||
tests('there are 2 listeners').returns(2) { elb3.listeners.count }
|
||||
tests('instance_port is 2030').returns(2030) { elb3.listeners.first.instance_port }
|
||||
tests('lb_port is 2030').returns(2030) { elb3.listeners.first.lb_port }
|
||||
|
@ -81,23 +81,23 @@ Shindo.tests('AWS::ELB | models', ['aws', 'elb']) do
|
|||
'Listener' => {
|
||||
'LoadBalancerPort' => 443, 'InstancePort' => 80, 'Protocol' => 'HTTPS', "SSLCertificateId" => "fakecert"}
|
||||
}]
|
||||
AWS[:elb].load_balancers.create(:id => "#{elb_id}-4", "ListenerDescriptions" => listeners)
|
||||
Fog::AWS[:elb].load_balancers.create(:id => "#{elb_id}-4", "ListenerDescriptions" => listeners)
|
||||
end
|
||||
end
|
||||
|
||||
tests('all') do
|
||||
elb_ids = AWS[:elb].load_balancers.all.map{|e| e.id}
|
||||
elb_ids = Fog::AWS[:elb].load_balancers.all.map{|e| e.id}
|
||||
tests("contains elb").returns(true) { elb_ids.include? elb_id }
|
||||
end
|
||||
|
||||
tests('get') do
|
||||
elb_get = AWS[:elb].load_balancers.get(elb_id)
|
||||
elb_get = Fog::AWS[:elb].load_balancers.get(elb_id)
|
||||
tests('ids match').returns(elb_id) { elb_get.id }
|
||||
end
|
||||
|
||||
tests('creating a duplicate elb') do
|
||||
raises(Fog::AWS::ELB::IdentifierTaken) do
|
||||
AWS[:elb].load_balancers.create(:id => elb_id, :availability_zones => ['us-east-1d'])
|
||||
Fog::AWS[:elb].load_balancers.create(:id => elb_id, :availability_zones => ['us-east-1d'])
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -246,6 +246,6 @@ Shindo.tests('AWS::ELB | models', ['aws', 'elb']) do
|
|||
elb.destroy
|
||||
end
|
||||
|
||||
AWS[:iam].delete_server_certificate(@key_name)
|
||||
Fog::AWS[:iam].delete_server_certificate(@key_name)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,7 +4,7 @@ Shindo.tests("AWS::RDS | parameter_group", ['aws', 'rds']) do
|
|||
params = {:id => group_name, :family => 'mysql5.1', :description => group_name}
|
||||
|
||||
pending if Fog.mocking?
|
||||
model_tests(AWS[:rds].parameter_groups, params, false) do
|
||||
model_tests(Fog::AWS[:rds].parameter_groups, params, false) do
|
||||
tests('#parameters') do
|
||||
#search for a sample parameter
|
||||
tests 'contains parameters' do
|
||||
|
|
|
@ -4,5 +4,5 @@ Shindo.tests("AWS::RDS | parameter_groups", ['aws', 'rds']) do
|
|||
params = {:id => group_name, :family => 'mysql5.1', :description => group_name}
|
||||
|
||||
pending if Fog.mocking?
|
||||
collection_tests(AWS[:rds].parameter_groups, params, false)
|
||||
collection_tests(Fog::AWS[:rds].parameter_groups, params, false)
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ Shindo.tests("AWS::RDS | security_group", ['aws', 'rds']) do
|
|||
params = {:id => group_name, :description => 'fog test'}
|
||||
|
||||
pending if Fog.mocking?
|
||||
model_tests(AWS[:rds].security_groups, params, false) do
|
||||
model_tests(Fog::AWS[:rds].security_groups, params, false) do
|
||||
|
||||
tests("#description").returns('fog test') { @instance.description }
|
||||
|
||||
|
|
|
@ -2,5 +2,5 @@ Shindo.tests("AWS::RDS | security groups", ['aws', 'rds']) do
|
|||
params = {:id => 'fog-test', :description => 'fog test'}
|
||||
|
||||
pending if Fog.mocking?
|
||||
collection_tests(AWS[:rds].security_groups, params, false)
|
||||
collection_tests(Fog::AWS[:rds].security_groups, params, false)
|
||||
end
|
||||
|
|
|
@ -2,9 +2,9 @@ Shindo.tests("AWS::RDS | server", ['aws', 'rds']) do
|
|||
|
||||
pending if Fog.mocking?
|
||||
|
||||
model_tests(AWS[:rds].servers, rds_default_server_params, false) do
|
||||
model_tests(Fog::AWS[:rds].servers, rds_default_server_params, false) do
|
||||
# We'll need this later; create it early to avoid waiting
|
||||
@instance_with_final_snapshot = AWS[:rds].servers.create(rds_default_server_params.merge(:id => uniq_id("fog-snapshot-test"), :backup_retention_period => 1))
|
||||
@instance_with_final_snapshot = Fog::AWS[:rds].servers.create(rds_default_server_params.merge(:id => uniq_id("fog-snapshot-test"), :backup_retention_period => 1))
|
||||
|
||||
@instance.wait_for(20*60) { ready? }
|
||||
|
||||
|
@ -26,10 +26,10 @@ Shindo.tests("AWS::RDS | server", ['aws', 'rds']) do
|
|||
|
||||
tests("#modify").succeeds do
|
||||
orig_parameter_group = @instance.db_parameter_groups.first['DBParameterGroupName']
|
||||
parameter_group = AWS[:rds].parameter_groups.create(:id => uniq_id, :family => 'mysql5.1', :description => 'fog-test')
|
||||
parameter_group = Fog::AWS[:rds].parameter_groups.create(:id => uniq_id, :family => 'mysql5.1', :description => 'fog-test')
|
||||
|
||||
orig_security_groups = @instance.db_security_groups.map{|h| h['DBSecurityGroupName']}
|
||||
security_group = AWS[:rds].security_groups.create(:id => uniq_id, :description => 'fog-test')
|
||||
security_group = Fog::AWS[:rds].security_groups.create(:id => uniq_id, :description => 'fog-test')
|
||||
|
||||
modify_options = {
|
||||
'DBParameterGroupName' => parameter_group.id,
|
||||
|
@ -92,7 +92,7 @@ Shindo.tests("AWS::RDS | server", ['aws', 'rds']) do
|
|||
@instance_with_final_snapshot.wait_for { ready? }
|
||||
@instance_with_final_snapshot.destroy(final_snapshot_id)
|
||||
returns(true, "Final snapshot created") do
|
||||
@final_snapshot = AWS[:rds].snapshots.get(final_snapshot_id)
|
||||
@final_snapshot = Fog::AWS[:rds].snapshots.get(final_snapshot_id)
|
||||
!@final_snapshot.nil?
|
||||
end
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ Shindo.tests("AWS::RDS | servers", ['aws', 'rds']) do
|
|||
|
||||
pending if Fog.mocking?
|
||||
|
||||
collection_tests(AWS[:rds].servers, rds_default_server_params, false) do
|
||||
collection_tests(Fog::AWS[:rds].servers, rds_default_server_params, false) do
|
||||
@instance.wait_for { ready? }
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,11 +2,11 @@ Shindo.tests("AWS::RDS | snapshot", ['aws', 'rds']) do
|
|||
|
||||
pending if Fog.mocking?
|
||||
|
||||
@server = AWS[:rds].servers.create(rds_default_server_params)
|
||||
@server = Fog::AWS[:rds].servers.create(rds_default_server_params)
|
||||
@server.wait_for { ready? }
|
||||
|
||||
params = {:id => uniq_id, :instance_id => @server.id}
|
||||
model_tests(AWS[:rds].snapshots, params, false) do
|
||||
model_tests(Fog::AWS[:rds].snapshots, params, false) do
|
||||
@instance.wait_for { ready? }
|
||||
end
|
||||
|
||||
|
|
|
@ -2,11 +2,11 @@ Shindo.tests("AWS::RDS | snapshots", ['aws', 'rds']) do
|
|||
|
||||
pending if Fog.mocking?
|
||||
|
||||
@server = AWS[:rds].servers.create(rds_default_server_params)
|
||||
@server = Fog::AWS[:rds].servers.create(rds_default_server_params)
|
||||
@server.wait_for { ready? }
|
||||
|
||||
params = {:id => uniq_id, :instance_id => @server.id}
|
||||
collection_tests(AWS[:rds].snapshots, params, false) do
|
||||
collection_tests(Fog::AWS[:rds].snapshots, params, false) do
|
||||
@instance.wait_for { ready? }
|
||||
end
|
||||
|
||||
|
|
|
@ -6,75 +6,75 @@ Shindo.tests('AWS::AutoScaling | auto_scaling_tests', ['aws', 'auto_scaling']) d
|
|||
pending if Fog.mocking?
|
||||
|
||||
tests("#describe_adjustment_types").formats(AWS::AutoScaling::Formats::DESCRIBE_ADJUSTMENT_TYPES) do
|
||||
AWS[:auto_scaling].describe_adjustment_types.body
|
||||
Fog::AWS[:auto_scaling].describe_adjustment_types.body
|
||||
end
|
||||
tests("#describe_metric_collection_types").formats(AWS::AutoScaling::Formats::DESCRIBE_METRIC_COLLECTION_TYPES) do
|
||||
AWS[:auto_scaling].describe_metric_collection_types.body
|
||||
Fog::AWS[:auto_scaling].describe_metric_collection_types.body
|
||||
end
|
||||
tests("#describe_scaling_process_types").formats(AWS::AutoScaling::Formats::DESCRIBE_SCALING_PROCESS_TYPES) do
|
||||
AWS[:auto_scaling].describe_scaling_process_types.body
|
||||
Fog::AWS[:auto_scaling].describe_scaling_process_types.body
|
||||
end
|
||||
|
||||
tests("#create_launch_configuration").formats(AWS::AutoScaling::Formats::BASIC) do
|
||||
image_id = 'ami-8c1fece5'
|
||||
instance_type = 't1.micro'
|
||||
#listeners = [{'LoadBalancerPort' => 80, 'InstancePort' => 80, 'Protocol' => 'http'}]
|
||||
AWS[:auto_scaling].create_launch_configuration(image_id, instance_type, @lc_name).body
|
||||
Fog::AWS[:auto_scaling].create_launch_configuration(image_id, instance_type, @lc_name).body
|
||||
end
|
||||
|
||||
tests("#describe_launch_configurations").formats(AWS::AutoScaling::Formats::DESCRIBE_LAUNCH_CONFIGURATIONS) do
|
||||
AWS[:auto_scaling].describe_launch_configurations().body
|
||||
Fog::AWS[:auto_scaling].describe_launch_configurations().body
|
||||
end
|
||||
tests("#describe_launch_configurations").formats(AWS::AutoScaling::Formats::DESCRIBE_LAUNCH_CONFIGURATIONS) do
|
||||
AWS[:auto_scaling].describe_launch_configurations('LaunchConfigurationNames' => @lc_name).body
|
||||
Fog::AWS[:auto_scaling].describe_launch_configurations('LaunchConfigurationNames' => @lc_name).body
|
||||
end
|
||||
tests("#describe_launch_configurations").formats(AWS::AutoScaling::Formats::DESCRIBE_LAUNCH_CONFIGURATIONS) do
|
||||
AWS[:auto_scaling].describe_launch_configurations('LaunchConfigurationNames' => [@lc_name]).body
|
||||
Fog::AWS[:auto_scaling].describe_launch_configurations('LaunchConfigurationNames' => [@lc_name]).body
|
||||
end
|
||||
|
||||
tests("#create_auto_scaling_group").formats(AWS::AutoScaling::Formats::BASIC) do
|
||||
zones = ['us-east-1d']
|
||||
max_size = 0
|
||||
min_size = 0
|
||||
AWS[:auto_scaling].create_auto_scaling_group(@asg_name, zones, @lc_name, max_size, min_size).body
|
||||
Fog::AWS[:auto_scaling].create_auto_scaling_group(@asg_name, zones, @lc_name, max_size, min_size).body
|
||||
end
|
||||
|
||||
tests("#describe_auto_scaling_groups").formats(AWS::AutoScaling::Formats::DESCRIBE_AUTO_SCALING_GROUPS) do
|
||||
AWS[:auto_scaling].describe_auto_scaling_groups().body
|
||||
Fog::AWS[:auto_scaling].describe_auto_scaling_groups().body
|
||||
end
|
||||
tests("#describe_auto_scaling_groups").formats(AWS::AutoScaling::Formats::DESCRIBE_AUTO_SCALING_GROUPS) do
|
||||
AWS[:auto_scaling].describe_auto_scaling_groups('AutoScalingGroupNames' => @asg_name).body
|
||||
Fog::AWS[:auto_scaling].describe_auto_scaling_groups('AutoScalingGroupNames' => @asg_name).body
|
||||
end
|
||||
tests("#describe_auto_scaling_groups").formats(AWS::AutoScaling::Formats::DESCRIBE_AUTO_SCALING_GROUPS) do
|
||||
AWS[:auto_scaling].describe_auto_scaling_groups('AutoScalingGroupNames' => [@asg_name]).body
|
||||
Fog::AWS[:auto_scaling].describe_auto_scaling_groups('AutoScalingGroupNames' => [@asg_name]).body
|
||||
end
|
||||
|
||||
tests("#describe_auto_scaling_instances").formats(AWS::AutoScaling::Formats::DESCRIBE_AUTO_SCALING_INSTANCES) do
|
||||
AWS[:auto_scaling].describe_auto_scaling_instances().body
|
||||
Fog::AWS[:auto_scaling].describe_auto_scaling_instances().body
|
||||
end
|
||||
|
||||
tests("#describe_scaling_activities").formats(AWS::AutoScaling::Formats::DESCRIBE_SCALING_ACTIVITIES) do
|
||||
AWS[:auto_scaling].describe_scaling_activities().body
|
||||
Fog::AWS[:auto_scaling].describe_scaling_activities().body
|
||||
end
|
||||
tests("#describe_scaling_activities").formats(AWS::AutoScaling::Formats::DESCRIBE_SCALING_ACTIVITIES) do
|
||||
AWS[:auto_scaling].describe_scaling_activities('ActivityIds' => '1').body
|
||||
Fog::AWS[:auto_scaling].describe_scaling_activities('ActivityIds' => '1').body
|
||||
end
|
||||
tests("#describe_scaling_activities").formats(AWS::AutoScaling::Formats::DESCRIBE_SCALING_ACTIVITIES) do
|
||||
AWS[:auto_scaling].describe_scaling_activities('ActivityIds' => ['1', '2']).body
|
||||
Fog::AWS[:auto_scaling].describe_scaling_activities('ActivityIds' => ['1', '2']).body
|
||||
end
|
||||
tests("#describe_scaling_activities").formats(AWS::AutoScaling::Formats::DESCRIBE_SCALING_ACTIVITIES) do
|
||||
AWS[:auto_scaling].describe_scaling_activities('AutoScalingGroupName' => @asg_name).body
|
||||
Fog::AWS[:auto_scaling].describe_scaling_activities('AutoScalingGroupName' => @asg_name).body
|
||||
end
|
||||
|
||||
tests("#set_desired_capacity").formats(AWS::AutoScaling::Formats::BASIC) do
|
||||
desired_capacity = 0
|
||||
AWS[:auto_scaling].set_desired_capacity(@asg_name, desired_capacity).body
|
||||
Fog::AWS[:auto_scaling].set_desired_capacity(@asg_name, desired_capacity).body
|
||||
end
|
||||
tests("#delete_auto_scaling_group").formats(AWS::AutoScaling::Formats::BASIC) do
|
||||
AWS[:auto_scaling].delete_auto_scaling_group(@asg_name).body
|
||||
Fog::AWS[:auto_scaling].delete_auto_scaling_group(@asg_name).body
|
||||
end
|
||||
tests("#delete_launch_configuration").formats(AWS::AutoScaling::Formats::BASIC) do
|
||||
AWS[:auto_scaling].delete_launch_configuration(@lc_name).body
|
||||
Fog::AWS[:auto_scaling].delete_launch_configuration(@lc_name).body
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -8,55 +8,55 @@ Shindo.tests('AWS::AutoScaling | model_tests', ['aws', 'auto_scaling']) do
|
|||
|
||||
tests('configurations') do
|
||||
tests('getting a missing configuration') do
|
||||
returns(nil) { AWS[:auto_scaling].configurations.get('fog-no-such-lc') }
|
||||
returns(nil) { Fog::AWS[:auto_scaling].configurations.get('fog-no-such-lc') }
|
||||
end
|
||||
|
||||
tests('create configuration') do
|
||||
lc = AWS[:auto_scaling].configurations.create(:id => lc_id, :image_id => 'ami-8c1fece5', :instance_type => 't1.micro')
|
||||
lc = Fog::AWS[:auto_scaling].configurations.create(:id => lc_id, :image_id => 'ami-8c1fece5', :instance_type => 't1.micro')
|
||||
#tests("dns names is set").returns(true) { lc.dns_name.is_a?(String) }
|
||||
tests("created_at is set").returns(true) { Time === lc.created_at }
|
||||
#tests("policies is empty").returns([]) { lc.policies }
|
||||
end
|
||||
|
||||
tests('all configurations') do
|
||||
lc_ids = AWS[:auto_scaling].configurations.all.map{|e| e.id}
|
||||
lc_ids = Fog::AWS[:auto_scaling].configurations.all.map{|e| e.id}
|
||||
tests("contains lc").returns(true) { lc_ids.include? lc_id }
|
||||
end
|
||||
|
||||
tests('get configuration') do
|
||||
lc2 = AWS[:auto_scaling].configurations.get(lc_id)
|
||||
lc2 = Fog::AWS[:auto_scaling].configurations.get(lc_id)
|
||||
tests('ids match').returns(lc_id) { lc2.id }
|
||||
end
|
||||
|
||||
tests('creating a duplicate configuration') do
|
||||
raises(Fog::AWS::AutoScaling::IdentifierTaken) do
|
||||
AWS[:auto_scaling].configurations.create(:id => lc_id, :image_id => 'ami-8c1fece5', :instance_type => 't1.micro')
|
||||
Fog::AWS[:auto_scaling].configurations.create(:id => lc_id, :image_id => 'ami-8c1fece5', :instance_type => 't1.micro')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
tests('groups') do
|
||||
tests('getting a missing group') do
|
||||
returns(nil) { AWS[:auto_scaling].groups.get('fog-no-such-asg') }
|
||||
returns(nil) { Fog::AWS[:auto_scaling].groups.get('fog-no-such-asg') }
|
||||
end
|
||||
|
||||
asg = nil
|
||||
asg_id = 'fog-model-asg'
|
||||
|
||||
tests('create') do
|
||||
asg = AWS[:auto_scaling].groups.create(:id => asg_id, :availability_zones => ['us-east-1d'], :launch_configuration_name => lc_id)
|
||||
asg = Fog::AWS[:auto_scaling].groups.create(:id => asg_id, :availability_zones => ['us-east-1d'], :launch_configuration_name => lc_id)
|
||||
#tests("dns names is set").returns(true) { asg.dns_name.is_a?(String) }
|
||||
tests("created_at is set").returns(true) { Time === asg.created_at }
|
||||
#tests("policies is empty").returns([]) { asg.policies }
|
||||
end
|
||||
|
||||
tests('all') do
|
||||
asg_ids = AWS[:auto_scaling].groups.all.map{|e| e.id}
|
||||
asg_ids = Fog::AWS[:auto_scaling].groups.all.map{|e| e.id}
|
||||
tests("contains asg").returns(true) { asg_ids.include? asg_id }
|
||||
end
|
||||
|
||||
tests('get') do
|
||||
asg2 = AWS[:auto_scaling].groups.get(asg_id)
|
||||
asg2 = Fog::AWS[:auto_scaling].groups.get(asg_id)
|
||||
tests('ids match').returns(asg_id) { asg2.id }
|
||||
end
|
||||
|
||||
|
@ -72,7 +72,7 @@ Shindo.tests('AWS::AutoScaling | model_tests', ['aws', 'auto_scaling']) do
|
|||
|
||||
tests('creating a duplicate group') do
|
||||
raises(Fog::AWS::AutoScaling::IdentifierTaken) do
|
||||
AWS[:auto_scaling].groups.create(:id => asg_id, :availability_zones => ['us-east-1d'], :launch_configuration_name => lc_id)
|
||||
Fog::AWS[:auto_scaling].groups.create(:id => asg_id, :availability_zones => ['us-east-1d'], :launch_configuration_name => lc_id)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -97,7 +97,7 @@ Shindo.tests('AWS::AutoScaling | model_tests', ['aws', 'auto_scaling']) do
|
|||
end
|
||||
end
|
||||
|
||||
#server = AWS[:compute].servers.create
|
||||
#server = Fog::AWS[:compute].servers.create
|
||||
#tests('register instance') do
|
||||
# begin
|
||||
# elb.register_instances(server.id)
|
||||
|
|
|
@ -91,12 +91,12 @@ Shindo.tests('AWS::CloudFormation | stack requests', ['aws', 'cloudformation'])
|
|||
|
||||
tests("validate_template('TemplateURL' => '#{@template_url}')").formats(@validate_template_format) do
|
||||
pending if Fog.mocking?
|
||||
AWS[:cloud_formation].validate_template('TemplateURL' => @template_url).body
|
||||
Fog::AWS[:cloud_formation].validate_template('TemplateURL' => @template_url).body
|
||||
end
|
||||
|
||||
tests("create_stack('#{@stack_name}', 'TemplateURL' => '#{@template_url}', Parameters => {'KeyName' => 'cloudformation'})").formats(@create_stack_format) do
|
||||
pending if Fog.mocking?
|
||||
AWS[:cloud_formation].create_stack(
|
||||
Fog::AWS[:cloud_formation].create_stack(
|
||||
@stack_name,
|
||||
'TemplateURL' => @template_url,
|
||||
'Parameters' => {'KeyName' => 'cloudformation'}
|
||||
|
@ -105,29 +105,29 @@ Shindo.tests('AWS::CloudFormation | stack requests', ['aws', 'cloudformation'])
|
|||
|
||||
tests("get_template('#{@stack_name})").formats(@get_template_format) do
|
||||
pending if Fog.mocking?
|
||||
AWS[:cloud_formation].get_template(@stack_name).body
|
||||
Fog::AWS[:cloud_formation].get_template(@stack_name).body
|
||||
end
|
||||
|
||||
tests("describe_stacks").formats(@describe_stacks_format) do
|
||||
pending if Fog.mocking?
|
||||
AWS[:cloud_formation].describe_stacks.body
|
||||
Fog::AWS[:cloud_formation].describe_stacks.body
|
||||
end
|
||||
|
||||
sleep(1) # avoid throttling
|
||||
|
||||
tests("describe_stack_events('#{@stack_name}')").formats(@describe_stack_events_format) do
|
||||
pending if Fog.mocking?
|
||||
AWS[:cloud_formation].describe_stack_events(@stack_name).body
|
||||
Fog::AWS[:cloud_formation].describe_stack_events(@stack_name).body
|
||||
end
|
||||
|
||||
tests("describe_stack_resources('StackName' => '#{@stack_name}')").formats(@describe_stack_resources_format) do
|
||||
pending if Fog.mocking?
|
||||
AWS[:cloud_formation].describe_stack_resources('StackName' => @stack_name).body
|
||||
Fog::AWS[:cloud_formation].describe_stack_resources('StackName' => @stack_name).body
|
||||
end
|
||||
|
||||
tests("delete_stack('#{@stack_name}')").succeeds do
|
||||
pending if Fog.mocking?
|
||||
AWS[:cloud_formation].delete_stack(@stack_name)
|
||||
Fog::AWS[:cloud_formation].delete_stack(@stack_name)
|
||||
end
|
||||
|
||||
unless Fog.mocking?
|
||||
|
|
|
@ -22,7 +22,7 @@ Shindo.tests('AWS::CloudWatch | metric requests', ['aws', 'cloudwatch']) do
|
|||
tests("#get_metric_statistics").formats(@metrics_statistic_format) do
|
||||
pending if Fog.mocking?
|
||||
instanceId = 'i-420c352f'
|
||||
AWS[:cloud_watch].get_metric_statistics({'Statistics' => ['Minimum','Maximum','Sum','SampleCount','Average'], 'StartTime' => (Time.now-600).iso8601, 'EndTime' => Time.now.iso8601, 'Period' => 60, 'MetricName' => 'DiskReadBytes', 'Namespace' => 'AWS/EC2', 'Dimensions' => [{'Name' => 'InstanceId', 'Value' => instanceId}]}).body
|
||||
Fog::AWS[:cloud_watch].get_metric_statistics({'Statistics' => ['Minimum','Maximum','Sum','SampleCount','Average'], 'StartTime' => (Time.now-600).iso8601, 'EndTime' => Time.now.iso8601, 'Period' => 60, 'MetricName' => 'DiskReadBytes', 'Namespace' => 'AWS/EC2', 'Dimensions' => [{'Name' => 'InstanceId', 'Value' => instanceId}]}).body
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -37,18 +37,18 @@ Shindo.tests('AWS::CloudWatch | metric requests', ['aws', 'cloudwatch']) do
|
|||
|
||||
tests("#list_metrics").formats(@metrics_list_format) do
|
||||
pending if Fog.mocking?
|
||||
AWS[:cloud_watch].list_metrics.body
|
||||
Fog::AWS[:cloud_watch].list_metrics.body
|
||||
end
|
||||
|
||||
tests("#dimension_filtered_list_metrics").formats(@dimension_filtered_metrics_list_format) do
|
||||
pending if Fog.mocking?
|
||||
AWS[:cloud_watch].list_metrics('Dimensions' => [{'Name' => 'InstanceId', 'Value' => @instanceId}]).body
|
||||
Fog::AWS[:cloud_watch].list_metrics('Dimensions' => [{'Name' => 'InstanceId', 'Value' => @instanceId}]).body
|
||||
end
|
||||
|
||||
tests("#metric_name_filtered_list_metrics").returns(true) do
|
||||
pending if Fog.mocking?
|
||||
metricName = "CPUUtilization"
|
||||
AWS[:cloud_watch].list_metrics('MetricName' => metricName).body['ListMetricsResult']['Metrics'].all? do |metric|
|
||||
Fog::AWS[:cloud_watch].list_metrics('MetricName' => metricName).body['ListMetricsResult']['Metrics'].all? do |metric|
|
||||
metric['MetricName'] == metricName
|
||||
end
|
||||
end
|
||||
|
@ -56,7 +56,7 @@ Shindo.tests('AWS::CloudWatch | metric requests', ['aws', 'cloudwatch']) do
|
|||
tests("#namespace_filtered_list_metrics").returns(true) do
|
||||
pending if Fog.mocking?
|
||||
namespace = "AWS/EC2"
|
||||
AWS[:cloud_watch].list_metrics('Namespace' => namespace).body['ListMetricsResult']['Metrics'].all? do |metric|
|
||||
Fog::AWS[:cloud_watch].list_metrics('Namespace' => namespace).body['ListMetricsResult']['Metrics'].all? do |metric|
|
||||
metric['Namespace'] == namespace
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,18 +6,18 @@ Shindo.tests('AWS::CloudWatch | metric requests', ['aws', 'cloudwatch']) do
|
|||
|
||||
tests('#puts_value').formats(@puts_format) do
|
||||
pending if Fog.mocking?
|
||||
AWS[:cloud_watch].put_metric_data(namespace, [{'MetricName' => 'RequestTest', 'Unit' => 'None', 'Value' => 1}]).body
|
||||
Fog::AWS[:cloud_watch].put_metric_data(namespace, [{'MetricName' => 'RequestTest', 'Unit' => 'None', 'Value' => 1}]).body
|
||||
end
|
||||
|
||||
tests('#puts_statistics_set').succeeds do
|
||||
pending if Fog.mocking?
|
||||
AWS[:cloud_watch].put_metric_data(namespace, [{'MetricName' => 'RequestTest', 'Unit' => 'None', 'StatisticValues' => {'Minimum' => 0, 'Maximum' => 9, 'Sum' => 45, 'SampleCount' => 10, 'Average' => 4.5}}]).body
|
||||
Fog::AWS[:cloud_watch].put_metric_data(namespace, [{'MetricName' => 'RequestTest', 'Unit' => 'None', 'StatisticValues' => {'Minimum' => 0, 'Maximum' => 9, 'Sum' => 45, 'SampleCount' => 10, 'Average' => 4.5}}]).body
|
||||
end
|
||||
|
||||
tests('#puts with dimensions').succeeds do
|
||||
pending if Fog.mocking?
|
||||
dimensions = [{}]
|
||||
AWS[:cloud_watch].put_metric_data(namespace, [{'MetricName' => 'RequestTest', 'Unit' => 'None', 'Value' => 1, 'Dimensions' => dimensions}]).body
|
||||
Fog::AWS[:cloud_watch].put_metric_data(namespace, [{'MetricName' => 'RequestTest', 'Unit' => 'None', 'Value' => 1, 'Dimensions' => dimensions}]).body
|
||||
end
|
||||
|
||||
tests('#puts more than one').succeeds do
|
||||
|
@ -29,7 +29,7 @@ Shindo.tests('AWS::CloudWatch | metric requests', ['aws', 'cloudwatch']) do
|
|||
end
|
||||
dp
|
||||
end
|
||||
AWS[:cloud_watch].put_metric_data(namespace, datapoints).body
|
||||
Fog::AWS[:cloud_watch].put_metric_data(namespace, datapoints).body
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -3,28 +3,28 @@ Shindo.tests('AWS::ELB | listener_tests', ['aws', 'elb']) do
|
|||
@key_name = 'fog-test'
|
||||
|
||||
tests('success') do
|
||||
AWS[:elb].create_load_balancer(['us-east-1a'], @load_balancer_id, [{'LoadBalancerPort' => 80, 'InstancePort' => 80, 'Protocol' => 'HTTP'}])
|
||||
@certificate = AWS[:iam].upload_server_certificate(AWS::IAM::SERVER_CERT_PUBLIC_KEY, AWS::IAM::SERVER_CERT_PRIVATE_KEY, @key_name).body['Certificate']
|
||||
Fog::AWS[:elb].create_load_balancer(['us-east-1a'], @load_balancer_id, [{'LoadBalancerPort' => 80, 'InstancePort' => 80, 'Protocol' => 'HTTP'}])
|
||||
@certificate = Fog::AWS[:iam].upload_server_certificate(AWS::IAM::SERVER_CERT_PUBLIC_KEY, AWS::IAM::SERVER_CERT_PRIVATE_KEY, @key_name).body['Certificate']
|
||||
|
||||
tests("#create_load_balancer_listeners").formats(AWS::ELB::Formats::BASIC) do
|
||||
listeners = [
|
||||
{'Protocol' => 'TCP', 'LoadBalancerPort' => 443, 'InstancePort' => 443, 'SSLCertificateId' => @certificate['Arn']},
|
||||
{'Protocol' => 'HTTP', 'LoadBalancerPort' => 80, 'InstancePort' => 80}
|
||||
]
|
||||
response = AWS[:elb].create_load_balancer_listeners(@load_balancer_id, listeners).body
|
||||
response = Fog::AWS[:elb].create_load_balancer_listeners(@load_balancer_id, listeners).body
|
||||
response
|
||||
end
|
||||
|
||||
tests("#delete_load_balancer_listeners").formats(AWS::ELB::Formats::BASIC) do
|
||||
ports = [80, 443]
|
||||
AWS[:elb].delete_load_balancer_listeners(@load_balancer_id, ports).body
|
||||
Fog::AWS[:elb].delete_load_balancer_listeners(@load_balancer_id, ports).body
|
||||
end
|
||||
|
||||
tests("#create_load_balancer_listeners with non-existant SSL certificate") do
|
||||
listeners = [
|
||||
{'Protocol' => 'HTTPS', 'LoadBalancerPort' => 443, 'InstancePort' => 443, 'SSLCertificateId' => 'non-existant'},
|
||||
]
|
||||
raises(Fog::AWS::IAM::NotFound) { AWS[:elb].create_load_balancer_listeners(@load_balancer_id, listeners) }
|
||||
raises(Fog::AWS::IAM::NotFound) { Fog::AWS[:elb].create_load_balancer_listeners(@load_balancer_id, listeners) }
|
||||
end
|
||||
|
||||
tests("#create_load_balancer_listeners with invalid SSL certificate").raises(Fog::AWS::IAM::NotFound) do
|
||||
|
@ -32,7 +32,7 @@ Shindo.tests('AWS::ELB | listener_tests', ['aws', 'elb']) do
|
|||
listeners = [
|
||||
{'Protocol' => 'HTTPS', 'LoadBalancerPort' => 443, 'InstancePort' => 443, 'SSLCertificateId' => "#{@certificate['Arn']}fake"},
|
||||
]
|
||||
AWS[:elb].create_load_balancer_listeners(@load_balancer_id, listeners).body
|
||||
Fog::AWS[:elb].create_load_balancer_listeners(@load_balancer_id, listeners).body
|
||||
end
|
||||
|
||||
# This is sort of fucked up, but it may or may not fail, thanks AWS
|
||||
|
@ -41,10 +41,10 @@ Shindo.tests('AWS::ELB | listener_tests', ['aws', 'elb']) do
|
|||
listeners = [
|
||||
{'Protocol' => 'HTTPS', 'LoadBalancerPort' => 443, 'InstancePort' => 443, 'SSLCertificateId' => @certificate['Arn']},
|
||||
]
|
||||
AWS[:elb].create_load_balancer_listeners(@load_balancer_id, listeners).body
|
||||
Fog::AWS[:elb].create_load_balancer_listeners(@load_balancer_id, listeners).body
|
||||
end
|
||||
|
||||
AWS[:iam].delete_server_certificate(@key_name)
|
||||
AWS[:elb].delete_load_balancer(@load_balancer_id)
|
||||
Fog::AWS[:iam].delete_server_certificate(@key_name)
|
||||
Fog::AWS[:elb].delete_load_balancer(@load_balancer_id)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,20 +3,20 @@ Shindo.tests('AWS::ELB | load_balancer_tests', ['aws', 'elb']) do
|
|||
@key_name = 'fog-test'
|
||||
|
||||
tests('success') do
|
||||
@certificate = AWS[:iam].upload_server_certificate(AWS::IAM::SERVER_CERT_PUBLIC_KEY, AWS::IAM::SERVER_CERT_PRIVATE_KEY, @key_name).body['Certificate']
|
||||
@certificate = Fog::AWS[:iam].upload_server_certificate(AWS::IAM::SERVER_CERT_PUBLIC_KEY, AWS::IAM::SERVER_CERT_PRIVATE_KEY, @key_name).body['Certificate']
|
||||
|
||||
tests("#create_load_balancer").formats(AWS::ELB::Formats::CREATE_LOAD_BALANCER) do
|
||||
zones = ['us-east-1a']
|
||||
listeners = [{'LoadBalancerPort' => 80, 'InstancePort' => 80, 'Protocol' => 'HTTP'}]
|
||||
AWS[:elb].create_load_balancer(zones, @load_balancer_id, listeners).body
|
||||
Fog::AWS[:elb].create_load_balancer(zones, @load_balancer_id, listeners).body
|
||||
end
|
||||
|
||||
tests("#describe_load_balancers").formats(AWS::ELB::Formats::DESCRIBE_LOAD_BALANCERS) do
|
||||
AWS[:elb].describe_load_balancers.body
|
||||
Fog::AWS[:elb].describe_load_balancers.body
|
||||
end
|
||||
|
||||
tests('#describe_load_balancers with bad lb') do
|
||||
raises(Fog::AWS::ELB::NotFound) { AWS[:elb].describe_load_balancers('none-such-lb') }
|
||||
raises(Fog::AWS::ELB::NotFound) { Fog::AWS[:elb].describe_load_balancers('none-such-lb') }
|
||||
end
|
||||
|
||||
tests("#describe_load_balancers with SSL listener") do
|
||||
|
@ -24,8 +24,8 @@ Shindo.tests('AWS::ELB | load_balancer_tests', ['aws', 'elb']) do
|
|||
listeners = [
|
||||
{'Protocol' => 'HTTPS', 'LoadBalancerPort' => 443, 'InstancePort' => 443, 'SSLCertificateId' => @certificate['Arn']},
|
||||
]
|
||||
AWS[:elb].create_load_balancer_listeners(@load_balancer_id, listeners)
|
||||
response = AWS[:elb].describe_load_balancers(@load_balancer_id).body
|
||||
Fog::AWS[:elb].create_load_balancer_listeners(@load_balancer_id, listeners)
|
||||
response = Fog::AWS[:elb].describe_load_balancers(@load_balancer_id).body
|
||||
tests("SSLCertificateId is set").returns(@certificate['Arn']) do
|
||||
listeners = response["DescribeLoadBalancersResult"]["LoadBalancerDescriptions"].first["ListenerDescriptions"]
|
||||
listeners.find {|l| l["Listener"]["Protocol"] == 'HTTPS' }["Listener"]["SSLCertificateId"]
|
||||
|
@ -41,21 +41,21 @@ Shindo.tests('AWS::ELB | load_balancer_tests', ['aws', 'elb']) do
|
|||
'HealthyThreshold' => 3
|
||||
}
|
||||
|
||||
AWS[:elb].configure_health_check(@load_balancer_id, health_check).body
|
||||
Fog::AWS[:elb].configure_health_check(@load_balancer_id, health_check).body
|
||||
end
|
||||
|
||||
tests("#delete_load_balancer").formats(AWS::ELB::Formats::DELETE_LOAD_BALANCER) do
|
||||
AWS[:elb].delete_load_balancer(@load_balancer_id).body
|
||||
Fog::AWS[:elb].delete_load_balancer(@load_balancer_id).body
|
||||
end
|
||||
|
||||
tests("#delete_load_balancer when non existant").formats(AWS::ELB::Formats::DELETE_LOAD_BALANCER) do
|
||||
AWS[:elb].delete_load_balancer('non-existant').body
|
||||
Fog::AWS[:elb].delete_load_balancer('non-existant').body
|
||||
end
|
||||
|
||||
tests("#delete_load_balancer when already deleted").formats(AWS::ELB::Formats::DELETE_LOAD_BALANCER) do
|
||||
AWS[:elb].delete_load_balancer(@load_balancer_id).body
|
||||
Fog::AWS[:elb].delete_load_balancer(@load_balancer_id).body
|
||||
end
|
||||
|
||||
AWS[:iam].delete_server_certificate(@key_name)
|
||||
Fog::AWS[:iam].delete_server_certificate(@key_name)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,39 +3,39 @@ Shindo.tests('AWS::ELB | policy_tests', ['aws', 'elb']) do
|
|||
|
||||
tests('success') do
|
||||
listeners = [{'LoadBalancerPort' => 80, 'InstancePort' => 80, 'Protocol' => 'HTTP'}]
|
||||
AWS[:elb].create_load_balancer(['us-east-1a'], @load_balancer_id, listeners)
|
||||
Fog::AWS[:elb].create_load_balancer(['us-east-1a'], @load_balancer_id, listeners)
|
||||
|
||||
tests("#create_app_cookie_stickiness_policy").formats(AWS::ELB::Formats::BASIC) do
|
||||
cookie, policy = 'fog-app-cookie', 'fog-app-policy'
|
||||
AWS[:elb].create_app_cookie_stickiness_policy(@load_balancer_id, policy, cookie).body
|
||||
Fog::AWS[:elb].create_app_cookie_stickiness_policy(@load_balancer_id, policy, cookie).body
|
||||
end
|
||||
|
||||
tests("#create_lb_cookie_stickiness_policy with expiry").formats(AWS::ELB::Formats::BASIC) do
|
||||
policy = 'fog-lb-expiry'
|
||||
expiry = 300
|
||||
AWS[:elb].create_lb_cookie_stickiness_policy(@load_balancer_id, policy, expiry).body
|
||||
Fog::AWS[:elb].create_lb_cookie_stickiness_policy(@load_balancer_id, policy, expiry).body
|
||||
end
|
||||
|
||||
tests("#create_lb_cookie_stickiness_policy without expiry").formats(AWS::ELB::Formats::BASIC) do
|
||||
policy = 'fog-lb-no-expiry'
|
||||
AWS[:elb].create_lb_cookie_stickiness_policy(@load_balancer_id, policy).body
|
||||
Fog::AWS[:elb].create_lb_cookie_stickiness_policy(@load_balancer_id, policy).body
|
||||
end
|
||||
|
||||
tests("#delete_load_balancer_policy").formats(AWS::ELB::Formats::BASIC) do
|
||||
policy = 'fog-lb-no-expiry'
|
||||
AWS[:elb].delete_load_balancer_policy(@load_balancer_id, policy).body
|
||||
Fog::AWS[:elb].delete_load_balancer_policy(@load_balancer_id, policy).body
|
||||
end
|
||||
|
||||
tests("#set_load_balancer_policies_of_listener adds policy").formats(AWS::ELB::Formats::BASIC) do
|
||||
port, policies = 80, ['fog-lb-expiry']
|
||||
AWS[:elb].set_load_balancer_policies_of_listener(@load_balancer_id, port, policies).body
|
||||
Fog::AWS[:elb].set_load_balancer_policies_of_listener(@load_balancer_id, port, policies).body
|
||||
end
|
||||
|
||||
tests("#set_load_balancer_policies_of_listener removes policy").formats(AWS::ELB::Formats::BASIC) do
|
||||
port = 80
|
||||
AWS[:elb].set_load_balancer_policies_of_listener(@load_balancer_id, port, []).body
|
||||
Fog::AWS[:elb].set_load_balancer_policies_of_listener(@load_balancer_id, port, []).body
|
||||
end
|
||||
|
||||
AWS[:elb].delete_load_balancer(@load_balancer_id)
|
||||
Fog::AWS[:elb].delete_load_balancer(@load_balancer_id)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
Shindo.tests('AWS::IAM | access key requests', ['aws']) do
|
||||
|
||||
unless Fog.mocking?
|
||||
AWS[:iam].create_user('fog_access_key_tests')
|
||||
Fog::AWS[:iam].create_user('fog_access_key_tests')
|
||||
end
|
||||
|
||||
tests('success') do
|
||||
|
@ -18,7 +18,7 @@ Shindo.tests('AWS::IAM | access key requests', ['aws']) do
|
|||
|
||||
tests("#create_access_key('UserName' => 'fog_access_key_tests')").formats(@access_key_format) do
|
||||
pending if Fog.mocking?
|
||||
data = AWS[:iam].create_access_key('UserName' => 'fog_access_key_tests').body
|
||||
data = Fog::AWS[:iam].create_access_key('UserName' => 'fog_access_key_tests').body
|
||||
@access_key_id = data['AccessKey']['AccessKeyId']
|
||||
data
|
||||
end
|
||||
|
@ -34,17 +34,17 @@ Shindo.tests('AWS::IAM | access key requests', ['aws']) do
|
|||
|
||||
tests("#list_access_keys('Username' => 'fog_access_key_tests')").formats(@access_keys_format) do
|
||||
pending if Fog.mocking?
|
||||
AWS[:iam].list_access_keys('UserName' => 'fog_access_key_tests').body
|
||||
Fog::AWS[:iam].list_access_keys('UserName' => 'fog_access_key_tests').body
|
||||
end
|
||||
|
||||
tests("#update_access_key('#{@access_key_id}', 'Inactive', 'UserName' => 'fog_access_key_tests')").formats(AWS::IAM::Formats::BASIC) do
|
||||
pending if Fog.mocking?
|
||||
AWS[:iam].update_access_key(@access_key_id, 'Inactive', 'UserName' => 'fog_access_key_tests').body
|
||||
Fog::AWS[:iam].update_access_key(@access_key_id, 'Inactive', 'UserName' => 'fog_access_key_tests').body
|
||||
end
|
||||
|
||||
tests("#delete_access_key('#{@access_key_id}', 'UserName' => 'fog_access_key_tests)").formats(AWS::IAM::Formats::BASIC) do
|
||||
pending if Fog.mocking?
|
||||
AWS[:iam].delete_access_key(@access_key_id, 'UserName' => 'fog_access_key_tests').body
|
||||
Fog::AWS[:iam].delete_access_key(@access_key_id, 'UserName' => 'fog_access_key_tests').body
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -54,7 +54,7 @@ Shindo.tests('AWS::IAM | access key requests', ['aws']) do
|
|||
end
|
||||
|
||||
unless Fog.mocking?
|
||||
AWS[:iam].delete_user('fog_access_key_tests')
|
||||
Fog::AWS[:iam].delete_user('fog_access_key_tests')
|
||||
end
|
||||
|
||||
end
|
|
@ -1,7 +1,7 @@
|
|||
Shindo.tests('AWS::IAM | group policy requests', ['aws']) do
|
||||
|
||||
unless Fog.mocking?
|
||||
AWS[:iam].create_group('fog_group_policy_tests')
|
||||
Fog::AWS[:iam].create_group('fog_group_policy_tests')
|
||||
end
|
||||
|
||||
tests('success') do
|
||||
|
@ -10,7 +10,7 @@ Shindo.tests('AWS::IAM | group policy requests', ['aws']) do
|
|||
|
||||
tests("#put_group_policy('fog_group_policy_tests', 'fog_policy', #{@policy.inspect})").formats(AWS::IAM::Formats::BASIC) do
|
||||
pending if Fog.mocking?
|
||||
AWS[:iam].put_group_policy('fog_group_policy_tests', 'fog_policy', @policy).body
|
||||
Fog::AWS[:iam].put_group_policy('fog_group_policy_tests', 'fog_policy', @policy).body
|
||||
end
|
||||
|
||||
@group_policies_format = {
|
||||
|
@ -21,12 +21,12 @@ Shindo.tests('AWS::IAM | group policy requests', ['aws']) do
|
|||
|
||||
tests("list_group_policies('fog_group_policy_tests')").formats(@group_policies_format) do
|
||||
pending if Fog.mocking?
|
||||
AWS[:iam].list_group_policies('fog_group_policy_tests').body
|
||||
Fog::AWS[:iam].list_group_policies('fog_group_policy_tests').body
|
||||
end
|
||||
|
||||
tests("#delete_group_policy('fog_group_policy_tests', 'fog_policy')").formats(AWS::IAM::Formats::BASIC) do
|
||||
pending if Fog.mocking?
|
||||
AWS[:iam].delete_group_policy('fog_group_policy_tests', 'fog_policy').body
|
||||
Fog::AWS[:iam].delete_group_policy('fog_group_policy_tests', 'fog_policy').body
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -36,7 +36,7 @@ Shindo.tests('AWS::IAM | group policy requests', ['aws']) do
|
|||
end
|
||||
|
||||
unless Fog.mocking?
|
||||
AWS[:iam].delete_group('fog_group_policy_tests')
|
||||
Fog::AWS[:iam].delete_group('fog_group_policy_tests')
|
||||
end
|
||||
|
||||
end
|
|
@ -14,7 +14,7 @@ Shindo.tests('AWS::IAM | group requests', ['aws']) do
|
|||
|
||||
tests("#create_group('fog_group')").formats(@group_format) do
|
||||
pending if Fog.mocking?
|
||||
AWS[:iam].create_group('fog_group').body
|
||||
Fog::AWS[:iam].create_group('fog_group').body
|
||||
end
|
||||
|
||||
@groups_format = {
|
||||
|
@ -30,12 +30,12 @@ Shindo.tests('AWS::IAM | group requests', ['aws']) do
|
|||
|
||||
tests("#list_groups").formats(@groups_format) do
|
||||
pending if Fog.mocking?
|
||||
AWS[:iam].list_groups.body
|
||||
Fog::AWS[:iam].list_groups.body
|
||||
end
|
||||
|
||||
tests("#delete_group('fog_group')").formats(AWS::IAM::Formats::BASIC) do
|
||||
pending if Fog.mocking?
|
||||
AWS[:iam].delete_group('fog_group').body
|
||||
Fog::AWS[:iam].delete_group('fog_group').body
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
Shindo.tests('AWS::IAM | user requests', ['aws']) do
|
||||
|
||||
unless Fog.mocking?
|
||||
AWS[:iam].create_user('fog_user')
|
||||
Fog::AWS[:iam].create_user('fog_user')
|
||||
end
|
||||
|
||||
|
||||
|
@ -17,12 +17,12 @@ Shindo.tests('AWS::IAM | user requests', ['aws']) do
|
|||
|
||||
tests("#create_login_profile('fog_user')").formats(@login_profile_format) do
|
||||
pending if Fog.mocking?
|
||||
AWS[:iam].create_login_profile('fog_user', 'somepassword').body
|
||||
Fog::AWS[:iam].create_login_profile('fog_user', 'somepassword').body
|
||||
end
|
||||
|
||||
tests("#get_login_profile('fog_user')").formats(@login_profile_format) do
|
||||
pending if Fog.mocking?
|
||||
result = AWS[:iam].get_login_profile('fog_user').body
|
||||
result = Fog::AWS[:iam].get_login_profile('fog_user').body
|
||||
returns('fog_user') {result['LoginProfile']['UserName']}
|
||||
result
|
||||
end
|
||||
|
@ -30,7 +30,7 @@ Shindo.tests('AWS::IAM | user requests', ['aws']) do
|
|||
tests("#update_login_profile('fog_user')").formats(AWS::IAM::Formats::BASIC) do
|
||||
pending if Fog.mocking?
|
||||
begin
|
||||
AWS[:iam].update_login_profile('fog_user', 'otherpassword').body
|
||||
Fog::AWS[:iam].update_login_profile('fog_user', 'otherpassword').body
|
||||
rescue Excon::Errors::Conflict #profile cannot be updated or deleted until it has finished creating; api provides no way of telling whether creation process complete
|
||||
sleep 5
|
||||
retry
|
||||
|
@ -39,12 +39,12 @@ Shindo.tests('AWS::IAM | user requests', ['aws']) do
|
|||
|
||||
tests("#delete_login_profile('fog_user')").formats(AWS::IAM::Formats::BASIC) do
|
||||
pending if Fog.mocking?
|
||||
AWS[:iam].delete_login_profile('fog_user').body
|
||||
Fog::AWS[:iam].delete_login_profile('fog_user').body
|
||||
end
|
||||
|
||||
tests("#get_login_profile('fog_user')") do
|
||||
pending if Fog.mocking?
|
||||
raises(Excon::Errors::NotFound) {AWS[:iam].get_login_profile('fog_user')}
|
||||
raises(Excon::Errors::NotFound) {Fog::AWS[:iam].get_login_profile('fog_user')}
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -52,13 +52,13 @@ Shindo.tests('AWS::IAM | user requests', ['aws']) do
|
|||
tests('failure') do
|
||||
tests('get login profile for non existing user') do
|
||||
pending if Fog.mocking?
|
||||
raises(Fog::AWS::IAM::NotFound) { AWS[:iam].get_login_profile('idontexist')}
|
||||
raises(Fog::AWS::IAM::NotFound) { AWS[:iam].delete_login_profile('fog_user')}
|
||||
raises(Fog::AWS::IAM::NotFound) { Fog::AWS[:iam].get_login_profile('idontexist')}
|
||||
raises(Fog::AWS::IAM::NotFound) { Fog::AWS[:iam].delete_login_profile('fog_user')}
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
unless Fog.mocking?
|
||||
AWS[:iam].delete_user('fog_user')
|
||||
Fog::AWS[:iam].delete_user('fog_user')
|
||||
end
|
||||
end
|
||||
|
|
|
@ -19,44 +19,44 @@ Shindo.tests('AWS::IAM | server certificate requests', ['aws']) do
|
|||
private_key_mismatch = AWS::IAM::SERVER_CERT_PRIVATE_KEY_MISMATCHED
|
||||
|
||||
tests('empty public key').raises(Fog::AWS::IAM::ValidationError) do
|
||||
AWS[:iam].upload_server_certificate('', private_key, @key_name)
|
||||
Fog::AWS[:iam].upload_server_certificate('', private_key, @key_name)
|
||||
end
|
||||
|
||||
tests('empty private key').raises(Fog::AWS::IAM::ValidationError) do
|
||||
AWS[:iam].upload_server_certificate(public_key, '', @key_name)
|
||||
Fog::AWS[:iam].upload_server_certificate(public_key, '', @key_name)
|
||||
end
|
||||
|
||||
tests('invalid public key').raises(Fog::AWS::IAM::MalformedCertificate) do
|
||||
AWS[:iam].upload_server_certificate('abcde', private_key, @key_name)
|
||||
Fog::AWS[:iam].upload_server_certificate('abcde', private_key, @key_name)
|
||||
end
|
||||
|
||||
tests('invalid private key').raises(Fog::AWS::IAM::MalformedCertificate) do
|
||||
AWS[:iam].upload_server_certificate(public_key, 'abcde', @key_name)
|
||||
Fog::AWS[:iam].upload_server_certificate(public_key, 'abcde', @key_name)
|
||||
end
|
||||
|
||||
tests('mismatched private key').raises(Fog::AWS::IAM::KeyPairMismatch) do
|
||||
AWS[:iam].upload_server_certificate(public_key, private_key_mismatch, @key_name)
|
||||
Fog::AWS[:iam].upload_server_certificate(public_key, private_key_mismatch, @key_name)
|
||||
end
|
||||
|
||||
tests('format').formats(@upload_format) do
|
||||
AWS[:iam].upload_server_certificate(public_key, private_key, @key_name).body
|
||||
Fog::AWS[:iam].upload_server_certificate(public_key, private_key, @key_name).body
|
||||
end
|
||||
|
||||
tests('duplicate name').raises(Fog::AWS::IAM::EntityAlreadyExists) do
|
||||
AWS[:iam].upload_server_certificate(public_key, private_key, @key_name)
|
||||
Fog::AWS[:iam].upload_server_certificate(public_key, private_key, @key_name)
|
||||
end
|
||||
end
|
||||
|
||||
tests('#get_server_certificate').formats(@upload_format) do
|
||||
tests('raises NotFound').raises(Fog::AWS::IAM::NotFound) do
|
||||
AWS[:iam].get_server_certificate("#{@key_name}fake")
|
||||
Fog::AWS[:iam].get_server_certificate("#{@key_name}fake")
|
||||
end
|
||||
AWS[:iam].get_server_certificate(@key_name).body
|
||||
Fog::AWS[:iam].get_server_certificate(@key_name).body
|
||||
end
|
||||
|
||||
@list_format = { 'Certificates' => [@certificate_format] }
|
||||
tests('#list_server_certificates').formats(@list_format) do
|
||||
result = AWS[:iam].list_server_certificates.body
|
||||
result = Fog::AWS[:iam].list_server_certificates.body
|
||||
tests('includes key name') do
|
||||
returns(true) { result['Certificates'].any?{|c| c['ServerCertificateName'] == @key_name} }
|
||||
end
|
||||
|
@ -64,6 +64,6 @@ Shindo.tests('AWS::IAM | server certificate requests', ['aws']) do
|
|||
end
|
||||
|
||||
tests('#delete_server_certificate').formats(AWS::IAM::Formats::BASIC) do
|
||||
AWS[:iam].delete_server_certificate(@key_name).body
|
||||
Fog::AWS[:iam].delete_server_certificate(@key_name).body
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
Shindo.tests('AWS::IAM | user policy requests', ['aws']) do
|
||||
|
||||
unless Fog.mocking?
|
||||
AWS[:iam].create_user('fog_user_policy_tests')
|
||||
Fog::AWS[:iam].create_user('fog_user_policy_tests')
|
||||
end
|
||||
|
||||
tests('success') do
|
||||
|
@ -10,7 +10,7 @@ Shindo.tests('AWS::IAM | user policy requests', ['aws']) do
|
|||
|
||||
tests("#put_user_policy('fog_user_policy_tests', 'fog_policy', #{@policy.inspect})").formats(AWS::IAM::Formats::BASIC) do
|
||||
pending if Fog.mocking?
|
||||
AWS[:iam].put_user_policy('fog_user_policy_tests', 'fog_policy', @policy).body
|
||||
Fog::AWS[:iam].put_user_policy('fog_user_policy_tests', 'fog_policy', @policy).body
|
||||
end
|
||||
|
||||
@user_policies_format = {
|
||||
|
@ -21,12 +21,12 @@ Shindo.tests('AWS::IAM | user policy requests', ['aws']) do
|
|||
|
||||
tests("list_user_policies('fog_user_policy_tests')").formats(@user_policies_format) do
|
||||
pending if Fog.mocking?
|
||||
AWS[:iam].list_user_policies('fog_user_policy_tests').body
|
||||
Fog::AWS[:iam].list_user_policies('fog_user_policy_tests').body
|
||||
end
|
||||
|
||||
tests("#delete_user_policy('fog_user_policy_tests', 'fog_policy')").formats(AWS::IAM::Formats::BASIC) do
|
||||
pending if Fog.mocking?
|
||||
AWS[:iam].delete_user_policy('fog_user_policy_tests', 'fog_policy').body
|
||||
Fog::AWS[:iam].delete_user_policy('fog_user_policy_tests', 'fog_policy').body
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -36,7 +36,7 @@ Shindo.tests('AWS::IAM | user policy requests', ['aws']) do
|
|||
end
|
||||
|
||||
unless Fog.mocking?
|
||||
AWS[:iam].delete_user('fog_user_policy_tests')
|
||||
Fog::AWS[:iam].delete_user('fog_user_policy_tests')
|
||||
end
|
||||
|
||||
end
|
|
@ -1,7 +1,7 @@
|
|||
Shindo.tests('AWS::IAM | user requests', ['aws']) do
|
||||
|
||||
unless Fog.mocking?
|
||||
AWS[:iam].create_group('fog_user_tests')
|
||||
Fog::AWS[:iam].create_group('fog_user_tests')
|
||||
end
|
||||
|
||||
tests('success') do
|
||||
|
@ -18,7 +18,7 @@ Shindo.tests('AWS::IAM | user requests', ['aws']) do
|
|||
|
||||
tests("#create_user('fog_user')").formats(@user_format) do
|
||||
pending if Fog.mocking?
|
||||
AWS[:iam].create_user('fog_user').body
|
||||
Fog::AWS[:iam].create_user('fog_user').body
|
||||
end
|
||||
|
||||
@users_format = {
|
||||
|
@ -34,22 +34,22 @@ Shindo.tests('AWS::IAM | user requests', ['aws']) do
|
|||
|
||||
tests("#list_users").formats(@users_format) do
|
||||
pending if Fog.mocking?
|
||||
AWS[:iam].list_users.body
|
||||
Fog::AWS[:iam].list_users.body
|
||||
end
|
||||
|
||||
tests("#add_user_to_group('fog_user_tests', 'fog_user')").formats(AWS::IAM::Formats::BASIC) do
|
||||
pending if Fog.mocking?
|
||||
AWS[:iam].add_user_to_group('fog_user_tests', 'fog_user').body
|
||||
Fog::AWS[:iam].add_user_to_group('fog_user_tests', 'fog_user').body
|
||||
end
|
||||
|
||||
tests("#remove_user_from_group('fog_user_tests', 'fog_user')").formats(AWS::IAM::Formats::BASIC) do
|
||||
pending if Fog.mocking?
|
||||
AWS[:iam].remove_user_from_group('fog_user_tests', 'fog_user').body
|
||||
Fog::AWS[:iam].remove_user_from_group('fog_user_tests', 'fog_user').body
|
||||
end
|
||||
|
||||
tests("#delete_user('fog_user')").formats(AWS::IAM::Formats::BASIC) do
|
||||
pending if Fog.mocking?
|
||||
AWS[:iam].delete_user('fog_user').body
|
||||
Fog::AWS[:iam].delete_user('fog_user').body
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -59,7 +59,7 @@ Shindo.tests('AWS::IAM | user requests', ['aws']) do
|
|||
end
|
||||
|
||||
unless Fog.mocking?
|
||||
AWS[:iam].delete_group('fog_user_tests')
|
||||
Fog::AWS[:iam].delete_group('fog_user_tests')
|
||||
end
|
||||
|
||||
end
|
|
@ -13,7 +13,7 @@ Shindo.tests('AWS::RDS | instance requests', ['aws', 'rds']) do
|
|||
pending if Fog.mocking?
|
||||
|
||||
tests("#create_db_instance").formats(AWS::RDS::Formats::CREATE_DB_INSTANCE) do
|
||||
result = AWS[:rds].create_db_instance(@db_instance_id, 'AllocatedStorage' => 5,
|
||||
result = Fog::AWS[:rds].create_db_instance(@db_instance_id, 'AllocatedStorage' => 5,
|
||||
'DBInstanceClass' => 'db.m1.small',
|
||||
'Engine' => 'mysql',
|
||||
'EngineVersion' => '5.1.50',
|
||||
|
@ -27,15 +27,15 @@ Shindo.tests('AWS::RDS | instance requests', ['aws', 'rds']) do
|
|||
end
|
||||
|
||||
tests("#describe_db_instances").formats(AWS::RDS::Formats::DESCRIBE_DB_INSTANCES) do
|
||||
AWS[:rds].describe_db_instances.body
|
||||
Fog::AWS[:rds].describe_db_instances.body
|
||||
end
|
||||
|
||||
server = AWS[:rds].servers.get(@db_instance_id)
|
||||
server = Fog::AWS[:rds].servers.get(@db_instance_id)
|
||||
server.wait_for {ready?}
|
||||
|
||||
new_storage = 6
|
||||
tests("#modify_db_instance with immediate apply").formats(AWS::RDS::Formats::MODIFY_DB_INSTANCE) do
|
||||
body = AWS[:rds].modify_db_instance(@db_instance_id, true, 'AllocatedStorage'=> new_storage).body
|
||||
body = Fog::AWS[:rds].modify_db_instance(@db_instance_id, true, 'AllocatedStorage'=> new_storage).body
|
||||
tests 'pending storage' do
|
||||
instance = body['ModifyDBInstanceResult']['DBInstance']
|
||||
returns(new_storage){instance['PendingModifiedValues']['AllocatedStorage']}
|
||||
|
@ -52,7 +52,7 @@ Shindo.tests('AWS::RDS | instance requests', ['aws', 'rds']) do
|
|||
|
||||
tests("reboot db instance") do
|
||||
tests("#reboot").formats(AWS::RDS::Formats::REBOOT_DB_INSTANCE) do
|
||||
AWS[:rds].reboot_db_instance(@db_instance_id).body
|
||||
Fog::AWS[:rds].reboot_db_instance(@db_instance_id).body
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -60,22 +60,22 @@ Shindo.tests('AWS::RDS | instance requests', ['aws', 'rds']) do
|
|||
server.reload.wait_for { state == 'available'}
|
||||
|
||||
tests("#create_db_snapshot").formats(AWS::RDS::Formats::CREATE_DB_SNAPSHOT) do
|
||||
body = AWS[:rds].create_db_snapshot(@db_instance_id, @db_snapshot_id).body
|
||||
body = Fog::AWS[:rds].create_db_snapshot(@db_instance_id, @db_snapshot_id).body
|
||||
returns('creating'){ body['CreateDBSnapshotResult']['DBSnapshot']['Status']}
|
||||
body
|
||||
end
|
||||
|
||||
tests("#describe_db_snapshots").formats(AWS::RDS::Formats::DESCRIBE_DB_SNAPSHOTS) do
|
||||
body = AWS[:rds].describe_db_snapshots.body
|
||||
body = Fog::AWS[:rds].describe_db_snapshots.body
|
||||
end
|
||||
|
||||
server.reload.wait_for { state == 'available' }
|
||||
|
||||
tests( "#create read replica").formats(AWS::RDS::Formats::CREATE_READ_REPLICA) do
|
||||
AWS[:rds].create_db_instance_read_replica(@db_replica_id, @db_instance_id).body
|
||||
Fog::AWS[:rds].create_db_instance_read_replica(@db_replica_id, @db_instance_id).body
|
||||
end
|
||||
|
||||
replica = AWS[:rds].servers.get(@db_replica_id)
|
||||
replica = Fog::AWS[:rds].servers.get(@db_replica_id)
|
||||
replica.wait_for {ready?}
|
||||
|
||||
tests("replica source") do
|
||||
|
@ -89,25 +89,25 @@ Shindo.tests('AWS::RDS | instance requests', ['aws', 'rds']) do
|
|||
|
||||
tests("#delete_db_instance").formats(AWS::RDS::Formats::DELETE_DB_INSTANCE) do
|
||||
#server.wait_for { state == 'available'}
|
||||
AWS[:rds].delete_db_instance(@db_replica_id, nil, true)
|
||||
body = AWS[:rds].delete_db_instance(@db_instance_id, @db_final_snapshot_id).body
|
||||
Fog::AWS[:rds].delete_db_instance(@db_replica_id, nil, true)
|
||||
body = Fog::AWS[:rds].delete_db_instance(@db_instance_id, @db_final_snapshot_id).body
|
||||
|
||||
tests "final snapshot" do
|
||||
returns('creating'){AWS[:rds].describe_db_snapshots(:snapshot_id => @db_final_snapshot_id).body['DescribeDBSnapshotsResult']['DBSnapshots'].first['Status']}
|
||||
returns('creating'){Fog::AWS[:rds].describe_db_snapshots(:snapshot_id => @db_final_snapshot_id).body['DescribeDBSnapshotsResult']['DBSnapshots'].first['Status']}
|
||||
end
|
||||
body
|
||||
end
|
||||
|
||||
tests("#delete_db_snapshot").formats(AWS::RDS::Formats::DELETE_DB_SNAPSHOT) do
|
||||
AWS[:rds].snapshots.get(@db_snapshot_id).wait_for { ready? }
|
||||
AWS[:rds].delete_db_snapshot(@db_snapshot_id).body
|
||||
Fog::AWS[:rds].snapshots.get(@db_snapshot_id).wait_for { ready? }
|
||||
Fog::AWS[:rds].delete_db_snapshot(@db_snapshot_id).body
|
||||
end
|
||||
|
||||
tests("snapshot.destroy") do
|
||||
snapshot = AWS[:rds].snapshots.get(@db_final_snapshot_id)
|
||||
snapshot = Fog::AWS[:rds].snapshots.get(@db_final_snapshot_id)
|
||||
snapshot.wait_for { ready? }
|
||||
snapshot.destroy
|
||||
returns(nil) { AWS[:rds].snapshots.get(@db_final_snapshot_id) }
|
||||
returns(nil) { Fog::AWS[:rds].snapshots.get(@db_final_snapshot_id) }
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -116,13 +116,13 @@ Shindo.tests('AWS::RDS | instance requests', ['aws', 'rds']) do
|
|||
pending if Fog.mocking?
|
||||
|
||||
tests "deleting nonexisting instance" do
|
||||
raises(Fog::AWS::RDS::NotFound) {AWS[:rds].delete_db_instance('doesnexist', 'irrelevant')}
|
||||
raises(Fog::AWS::RDS::NotFound) {Fog::AWS[:rds].delete_db_instance('doesnexist', 'irrelevant')}
|
||||
end
|
||||
tests "deleting non existing snapshot" do
|
||||
raises(Fog::AWS::RDS::NotFound) {AWS[:rds].delete_db_snapshot('doesntexist')}
|
||||
raises(Fog::AWS::RDS::NotFound) {Fog::AWS[:rds].delete_db_snapshot('doesntexist')}
|
||||
end
|
||||
tests "modifying non existing instance" do
|
||||
raises(Fog::AWS::RDS::NotFound) { AWS[:rds].modify_db_instance 'doesntexit', true, 'AllocatedStorage'=> 10}
|
||||
raises(Fog::AWS::RDS::NotFound) { Fog::AWS[:rds].modify_db_instance 'doesntexit', true, 'AllocatedStorage'=> 10}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,7 +4,7 @@ Shindo.tests('AWS::RDS | parameter group requests', ['aws', 'rds']) do
|
|||
|
||||
tests("#create_db_parameter_groups").formats(AWS::RDS::Formats::CREATE_DB_PARAMETER_GROUP) do
|
||||
pending if Fog.mocking?
|
||||
body = AWS[:rds].create_db_parameter_group('fog-group', 'MySQL5.1', 'Some description').body
|
||||
body = Fog::AWS[:rds].create_db_parameter_group('fog-group', 'MySQL5.1', 'Some description').body
|
||||
|
||||
returns( 'mysql5.1') { body['CreateDBParameterGroupResult']['DBParameterGroup']['DBParameterGroupFamily']}
|
||||
returns( 'fog-group') { body['CreateDBParameterGroupResult']['DBParameterGroup']['DBParameterGroupName']}
|
||||
|
@ -13,12 +13,12 @@ Shindo.tests('AWS::RDS | parameter group requests', ['aws', 'rds']) do
|
|||
body
|
||||
end
|
||||
|
||||
AWS[:rds].create_db_parameter_group('other-fog-group', 'MySQL5.1', 'Some description')
|
||||
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
|
||||
pending if Fog.mocking?
|
||||
|
||||
body = AWS[:rds].describe_db_parameter_groups().body
|
||||
body = Fog::AWS[:rds].describe_db_parameter_groups().body
|
||||
|
||||
returns(3) {body['DescribeDBParameterGroupsResult']['DBParameterGroups'].length}
|
||||
body
|
||||
|
@ -27,7 +27,7 @@ Shindo.tests('AWS::RDS | parameter group requests', ['aws', 'rds']) do
|
|||
tests("#describe_db_parameter_groups('fog-group)").formats(AWS::RDS::Formats::DESCRIBE_DB_PARAMETER_GROUP) do
|
||||
pending if Fog.mocking?
|
||||
|
||||
body = AWS[:rds].describe_db_parameter_groups('fog-group').body
|
||||
body = Fog::AWS[:rds].describe_db_parameter_groups('fog-group').body
|
||||
|
||||
returns(1) {body['DescribeDBParameterGroupsResult']['DBParameterGroups'].length}
|
||||
|
||||
|
@ -41,27 +41,27 @@ Shindo.tests('AWS::RDS | parameter group requests', ['aws', 'rds']) do
|
|||
|
||||
tests("delete_db_parameter_group").formats(AWS::RDS::Formats::BASIC) do
|
||||
pending if Fog.mocking?
|
||||
body = AWS[:rds].delete_db_parameter_group('fog-group').body
|
||||
body = Fog::AWS[:rds].delete_db_parameter_group('fog-group').body
|
||||
|
||||
raises(Fog::AWS::RDS::NotFound) {AWS[:rds].describe_db_parameter_groups('fog-group')}
|
||||
raises(Fog::AWS::RDS::NotFound) {Fog::AWS[:rds].describe_db_parameter_groups('fog-group')}
|
||||
|
||||
body
|
||||
end
|
||||
|
||||
AWS[:rds].delete_db_parameter_group('other-fog-group')
|
||||
Fog::AWS[:rds].delete_db_parameter_group('other-fog-group')
|
||||
end
|
||||
|
||||
tests("failures") do
|
||||
pending if Fog.mocking?
|
||||
raises(Fog::AWS::RDS::NotFound) {AWS[:rds].describe_db_parameter_groups('doesntexist')}
|
||||
raises(Fog::AWS::RDS::NotFound) {AWS[:rds].delete_db_parameter_group('doesntexist')}
|
||||
raises(Fog::AWS::RDS::NotFound) {Fog::AWS[:rds].describe_db_parameter_groups('doesntexist')}
|
||||
raises(Fog::AWS::RDS::NotFound) {Fog::AWS[:rds].delete_db_parameter_group('doesntexist')}
|
||||
|
||||
tests "creating second group with same id" do
|
||||
AWS[:rds].create_db_parameter_group('fog-group', 'MySQL5.1', 'Some description')
|
||||
raises(Fog::AWS::RDS::IdentifierTaken) {AWS[:rds].create_db_parameter_group('fog-group', 'MySQL5.1', 'Some description')}
|
||||
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
|
||||
|
||||
AWS[:rds].delete_db_parameter_group('fog-group')
|
||||
Fog::AWS[:rds].delete_db_parameter_group('fog-group')
|
||||
|
||||
end
|
||||
|
||||
|
|
|
@ -2,10 +2,10 @@ Shindo.tests('AWS::RDS | parameter requests', ['aws', 'rds']) do
|
|||
tests('success') do
|
||||
pending if Fog.mocking?
|
||||
|
||||
AWS[:rds].create_db_parameter_group('fog-group', 'MySQL5.1', 'Some description')
|
||||
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 = AWS[:rds].modify_db_parameter_group('fog-group',[
|
||||
body = Fog::AWS[:rds].modify_db_parameter_group('fog-group',[
|
||||
{'ParameterName' => 'query_cache_size',
|
||||
'ParameterValue' => '12345',
|
||||
'ApplyMethod' => 'immediate'}
|
||||
|
@ -15,12 +15,12 @@ Shindo.tests('AWS::RDS | parameter requests', ['aws', 'rds']) do
|
|||
end
|
||||
|
||||
tests('#describe_db_parameters').formats(AWS::RDS::Formats::DESCRIBE_DB_PARAMETERS) do
|
||||
AWS[:rds].describe_db_parameters('fog-group', :max_records => 20).body
|
||||
Fog::AWS[:rds].describe_db_parameters('fog-group', :max_records => 20).body
|
||||
end
|
||||
|
||||
|
||||
tests("#describe_db_parameters :source => 'user'")do
|
||||
body = AWS[:rds].describe_db_parameters('fog-group', :source => 'user').body
|
||||
body = Fog::AWS[:rds].describe_db_parameters('fog-group', :source => 'user').body
|
||||
returns(1){ body['DescribeDBParametersResult']['Parameters'].length}
|
||||
|
||||
param = body['DescribeDBParametersResult']['Parameters'].first
|
||||
|
@ -29,7 +29,7 @@ Shindo.tests('AWS::RDS | parameter requests', ['aws', 'rds']) do
|
|||
returns(true){param['IsModifiable']}
|
||||
returns('query_cache_size'){param['ParameterName']}
|
||||
end
|
||||
AWS[:rds].delete_db_parameter_group('fog-group')
|
||||
Fog::AWS[:rds].delete_db_parameter_group('fog-group')
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,18 +4,18 @@ Shindo.tests('AWS::SES | verified email address requests', ['aws', 'ses']) do
|
|||
|
||||
tests("#verify_email_address('test@example.com')").formats(AWS::SES::Formats::BASIC) do
|
||||
pending if Fog.mocking?
|
||||
AWS[:ses].verify_email_address('test@example.com').body
|
||||
Fog::AWS[:ses].verify_email_address('test@example.com').body
|
||||
end
|
||||
|
||||
tests("#list_verified_email_addresses").formats(AWS::SES::Formats::BASIC.merge('VerifiedEmailAddresses' => [String])) do
|
||||
pending if Fog.mocking?
|
||||
AWS[:ses].list_verified_email_addresses.body
|
||||
Fog::AWS[:ses].list_verified_email_addresses.body
|
||||
end
|
||||
|
||||
# email won't be there to delete, but succeeds regardless
|
||||
tests("#delete_verified_email_address('test@example.com')").formats(AWS::SES::Formats::BASIC) do
|
||||
pending if Fog.mocking?
|
||||
AWS[:ses].delete_verified_email_address('notaanemail@example.com').body
|
||||
Fog::AWS[:ses].delete_verified_email_address('notaanemail@example.com').body
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -2,57 +2,57 @@ Shindo.tests('AWS::SimpleDB | attributes requests', ['aws']) do
|
|||
|
||||
@domain_name = "fog_domain_#{Time.now.to_f.to_s.gsub('.','')}"
|
||||
|
||||
AWS[:sdb].create_domain(@domain_name)
|
||||
Fog::AWS[:sdb].create_domain(@domain_name)
|
||||
|
||||
tests('success') do
|
||||
|
||||
tests("#batch_put_attributes('#{@domain_name}', { 'a' => { 'b' => 'c', 'd' => 'e' }, 'x' => { 'y' => 'z' } }).body").formats(AWS::SimpleDB::Formats::BASIC) do
|
||||
AWS[:sdb].batch_put_attributes(@domain_name, { 'a' => { 'b' => 'c', 'd' => 'e' }, 'x' => { 'y' => 'z' } }).body
|
||||
Fog::AWS[:sdb].batch_put_attributes(@domain_name, { 'a' => { 'b' => 'c', 'd' => 'e' }, 'x' => { 'y' => 'z' } }).body
|
||||
end
|
||||
|
||||
tests("#get_attributes('#{@domain_name}', 'a', {'ConsistentRead' => true}).body['Attributes']").returns({'b' => ['c'], 'd' => ['e']}) do
|
||||
AWS[:sdb].get_attributes(@domain_name, 'a', {'ConsistentRead' => true}).body['Attributes']
|
||||
Fog::AWS[:sdb].get_attributes(@domain_name, 'a', {'ConsistentRead' => true}).body['Attributes']
|
||||
end
|
||||
|
||||
tests("#get_attributes('#{@domain_name}', 'AttributeName' => 'notanattribute')").succeeds do
|
||||
AWS[:sdb].get_attributes(@domain_name, 'AttributeName' => 'notanattribute')
|
||||
Fog::AWS[:sdb].get_attributes(@domain_name, 'AttributeName' => 'notanattribute')
|
||||
end
|
||||
|
||||
tests("#select('select * from #{@domain_name}', {'ConsistentRead' => true}).body['Items']").returns({'a' => { 'b' => ['c'], 'd' => ['e']}, 'x' => { 'y' => ['z'] } }) do
|
||||
pending if Fog.mocking?
|
||||
AWS[:sdb].select("select * from #{@domain_name}", {'ConsistentRead' => true}).body['Items']
|
||||
Fog::AWS[:sdb].select("select * from #{@domain_name}", {'ConsistentRead' => true}).body['Items']
|
||||
end
|
||||
|
||||
tests("#put_attributes('#{@domain_name}', 'conditional', { 'version' => '1' }).body").formats(AWS::SimpleDB::Formats::BASIC) do
|
||||
AWS[:sdb].put_attributes(@domain_name, 'conditional', { 'version' => '1' }).body
|
||||
Fog::AWS[:sdb].put_attributes(@domain_name, 'conditional', { 'version' => '1' }).body
|
||||
end
|
||||
|
||||
tests("#put_attributes('#{@domain_name}', 'conditional', { 'version' => '2' }, :expect => { 'version' => '1' }, :replace => ['version']).body").formats(AWS::SimpleDB::Formats::BASIC) do
|
||||
AWS[:sdb].put_attributes(@domain_name, 'conditional', { 'version' => '2' }, :expect => { 'version' => '1' }, :replace => ['version']).body
|
||||
Fog::AWS[:sdb].put_attributes(@domain_name, 'conditional', { 'version' => '2' }, :expect => { 'version' => '1' }, :replace => ['version']).body
|
||||
end
|
||||
|
||||
# Verify that we can delete individual attributes.
|
||||
tests("#delete_attributes('#{@domain_name}', 'a', {'d' => []})").succeeds do
|
||||
AWS[:sdb].delete_attributes(@domain_name, 'a', {'d' => []}).body
|
||||
Fog::AWS[:sdb].delete_attributes(@domain_name, 'a', {'d' => []}).body
|
||||
end
|
||||
|
||||
# Verify that individually deleted attributes are actually removed.
|
||||
tests("#get_attributes('#{@domain_name}', 'a', {'AttributeName' => ['d'], 'ConsistentRead' => true}).body['Attributes']").returns({}) do
|
||||
AWS[:sdb].get_attributes(@domain_name, 'a', {'AttributeName' => ['d'], 'ConsistentRead' => true}).body['Attributes']
|
||||
Fog::AWS[:sdb].get_attributes(@domain_name, 'a', {'AttributeName' => ['d'], 'ConsistentRead' => true}).body['Attributes']
|
||||
end
|
||||
|
||||
tests("#delete_attributes('#{@domain_name}', 'a').body").formats(AWS::SimpleDB::Formats::BASIC) do
|
||||
AWS[:sdb].delete_attributes(@domain_name, 'a').body
|
||||
Fog::AWS[:sdb].delete_attributes(@domain_name, 'a').body
|
||||
end
|
||||
|
||||
# Verify that we can delete entire domain, item combinations.
|
||||
tests("#delete_attributes('#{@domain_name}', 'a').body").succeeds do
|
||||
AWS[:sdb].delete_attributes(@domain_name, 'a').body
|
||||
Fog::AWS[:sdb].delete_attributes(@domain_name, 'a').body
|
||||
end
|
||||
|
||||
# Verify that deleting a domain, item combination removes all related attributes.
|
||||
tests("#get_attributes('#{@domain_name}', 'a', {'ConsistentRead' => true}).body['Attributes']").returns({}) do
|
||||
AWS[:sdb].get_attributes(@domain_name, 'a', {'ConsistentRead' => true}).body['Attributes']
|
||||
Fog::AWS[:sdb].get_attributes(@domain_name, 'a', {'ConsistentRead' => true}).body['Attributes']
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -60,27 +60,27 @@ Shindo.tests('AWS::SimpleDB | attributes requests', ['aws']) do
|
|||
tests('failure') do
|
||||
|
||||
tests("#batch_put_attributes('notadomain', { 'a' => { 'b' => 'c' }, 'x' => { 'y' => 'z' } })").raises(Excon::Errors::BadRequest) do
|
||||
AWS[:sdb].batch_put_attributes('notadomain', { 'a' => { 'b' => 'c' }, 'x' => { 'y' => 'z' } })
|
||||
Fog::AWS[:sdb].batch_put_attributes('notadomain', { 'a' => { 'b' => 'c' }, 'x' => { 'y' => 'z' } })
|
||||
end
|
||||
|
||||
tests("#get_attributes('notadomain', 'a')").raises(Excon::Errors::BadRequest) do
|
||||
AWS[:sdb].get_attributes('notadomain', 'a')
|
||||
Fog::AWS[:sdb].get_attributes('notadomain', 'a')
|
||||
end
|
||||
|
||||
tests("#put_attributes('notadomain', 'conditional', { 'version' => '1' })").raises(Excon::Errors::BadRequest) do
|
||||
AWS[:sdb].put_attributes('notadomain', 'foo', { 'version' => '1' })
|
||||
Fog::AWS[:sdb].put_attributes('notadomain', 'foo', { 'version' => '1' })
|
||||
end
|
||||
|
||||
tests("#put_attributes('#{@domain_name}', 'conditional', { 'version' => '2' }, :expect => { 'version' => '1' }, :replace => ['version'])").raises(Excon::Errors::Conflict) do
|
||||
AWS[:sdb].put_attributes(@domain_name, 'conditional', { 'version' => '2' }, :expect => { 'version' => '1' }, :replace => ['version'])
|
||||
Fog::AWS[:sdb].put_attributes(@domain_name, 'conditional', { 'version' => '2' }, :expect => { 'version' => '1' }, :replace => ['version'])
|
||||
end
|
||||
|
||||
tests("#delete_attributes('notadomain', 'a')").raises(Excon::Errors::BadRequest) do
|
||||
AWS[:sdb].delete_attributes('notadomain', 'a')
|
||||
Fog::AWS[:sdb].delete_attributes('notadomain', 'a')
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
AWS[:sdb].delete_domain(@domain_name)
|
||||
Fog::AWS[:sdb].delete_domain(@domain_name)
|
||||
|
||||
end
|
||||
|
|
|
@ -15,27 +15,27 @@ Shindo.tests('AWS::SimpleDB | domain requests', ['aws']) do
|
|||
tests('success') do
|
||||
|
||||
tests("#create_domain(#{@domain_name})").formats(AWS::SimpleDB::Formats::BASIC) do
|
||||
AWS[:sdb].create_domain(@domain_name).body
|
||||
Fog::AWS[:sdb].create_domain(@domain_name).body
|
||||
end
|
||||
|
||||
tests("#create_domain(#{@domain_name})").succeeds do
|
||||
AWS[:sdb].create_domain(@domain_name)
|
||||
Fog::AWS[:sdb].create_domain(@domain_name)
|
||||
end
|
||||
|
||||
tests("#domain_metadata(#{@domain_name})").formats(@domain_metadata_format) do
|
||||
AWS[:sdb].domain_metadata(@domain_name).body
|
||||
Fog::AWS[:sdb].domain_metadata(@domain_name).body
|
||||
end
|
||||
|
||||
tests("#list_domains").formats(AWS::SimpleDB::Formats::BASIC.merge('Domains' => [String])) do
|
||||
AWS[:sdb].list_domains.body
|
||||
Fog::AWS[:sdb].list_domains.body
|
||||
end
|
||||
|
||||
tests("#delete_domain(#{@domain_name})").formats(AWS::SimpleDB::Formats::BASIC) do
|
||||
AWS[:sdb].delete_domain(@domain_name).body
|
||||
Fog::AWS[:sdb].delete_domain(@domain_name).body
|
||||
end
|
||||
|
||||
tests("#delete_domain(#{@domain_name})").succeeds do
|
||||
AWS[:sdb].delete_domain(@domain_name)
|
||||
Fog::AWS[:sdb].delete_domain(@domain_name)
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -43,7 +43,7 @@ Shindo.tests('AWS::SimpleDB | domain requests', ['aws']) do
|
|||
tests('failure') do
|
||||
|
||||
tests("#domain_metadata('notadomain')").raises(Excon::Errors::BadRequest) do
|
||||
AWS[:sdb].domain_metadata('notadomain')
|
||||
Fog::AWS[:sdb].domain_metadata('notadomain')
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
Shindo.tests('AWS::SES | topic lifecycle tests', ['aws', 'sns']) do
|
||||
|
||||
unless Fog.mocking?
|
||||
@topic_arn = AWS[:sns].create_topic('fog_subscription_tests').body['TopicArn']
|
||||
@queue_url = AWS[:sqs].create_queue('fog_subscription_tests').body['QueueUrl']
|
||||
@queue_arn = AWS[:sqs].get_queue_attributes(@queue_url, 'QueueArn').body['Attributes']['QueueArn']
|
||||
AWS[:sqs].set_queue_attributes(
|
||||
@topic_arn = Fog::AWS[:sns].create_topic('fog_subscription_tests').body['TopicArn']
|
||||
@queue_url = Fog::AWS[:sqs].create_queue('fog_subscription_tests').body['QueueUrl']
|
||||
@queue_arn = Fog::AWS[:sqs].get_queue_attributes(@queue_url, 'QueueArn').body['Attributes']['QueueArn']
|
||||
Fog::AWS[:sqs].set_queue_attributes(
|
||||
@queue_url,
|
||||
'Policy',
|
||||
MultiJson.encode({
|
||||
|
@ -28,7 +28,7 @@ Shindo.tests('AWS::SES | topic lifecycle tests', ['aws', 'sns']) do
|
|||
|
||||
tests("#subscribe('#{@topic_arn}', '#{@queue_arn}', 'sqs')").formats(AWS::SNS::Formats::BASIC.merge('SubscriptionArn' => String)) do
|
||||
pending if Fog.mocking?
|
||||
body = AWS[:sns].subscribe(@topic_arn, @queue_arn, 'sqs').body
|
||||
body = Fog::AWS[:sns].subscribe(@topic_arn, @queue_arn, 'sqs').body
|
||||
@subscription_arn = body['SubscriptionArn']
|
||||
body
|
||||
end
|
||||
|
@ -45,31 +45,31 @@ Shindo.tests('AWS::SES | topic lifecycle tests', ['aws', 'sns']) do
|
|||
|
||||
tests("#list_subscriptions").formats(list_subscriptions_format) do
|
||||
pending if Fog.mocking?
|
||||
AWS[:sns].list_subscriptions.body
|
||||
Fog::AWS[:sns].list_subscriptions.body
|
||||
end
|
||||
|
||||
tests("#list_subscriptions_by_topic('#{@topic_arn}')").formats(list_subscriptions_format) do
|
||||
pending if Fog.mocking?
|
||||
body = AWS[:sns].list_subscriptions_by_topic(@topic_arn).body
|
||||
body = Fog::AWS[:sns].list_subscriptions_by_topic(@topic_arn).body
|
||||
end
|
||||
|
||||
tests("#publish('#{@topic_arn}', 'message')").formats(AWS::SNS::Formats::BASIC.merge('MessageId' => String)) do
|
||||
pending if Fog.mocking?
|
||||
body = AWS[:sns].publish(@topic_arn, 'message').body
|
||||
body = Fog::AWS[:sns].publish(@topic_arn, 'message').body
|
||||
end
|
||||
|
||||
tests("#receive_message('#{@queue_url}')...").returns('message') do
|
||||
pending if Fog.mocking?
|
||||
message = nil
|
||||
Fog.wait_for do
|
||||
message = AWS[:sqs].receive_message(@queue_url).body['Message'].first
|
||||
message = Fog::AWS[:sqs].receive_message(@queue_url).body['Message'].first
|
||||
end
|
||||
MultiJson.decode(message['Body'])['Message']
|
||||
end
|
||||
|
||||
tests("#unsubscribe('#{@subscription_arn}')").formats(AWS::SNS::Formats::BASIC) do
|
||||
pending if Fog.mocking?
|
||||
AWS[:sns].unsubscribe(@subscription_arn).body
|
||||
Fog::AWS[:sns].unsubscribe(@subscription_arn).body
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -79,8 +79,8 @@ Shindo.tests('AWS::SES | topic lifecycle tests', ['aws', 'sns']) do
|
|||
end
|
||||
|
||||
unless Fog.mocking?
|
||||
AWS[:sns].delete_topic(@topic_arn)
|
||||
AWS[:sqs].delete_queue(@queue_url)
|
||||
Fog::AWS[:sns].delete_topic(@topic_arn)
|
||||
Fog::AWS[:sqs].delete_queue(@queue_url)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -4,19 +4,19 @@ Shindo.tests('AWS::SES | topic lifecycle tests', ['aws', 'sns']) do
|
|||
|
||||
tests("#create_topic('fog_topic_tests')").formats(AWS::SNS::Formats::BASIC.merge('TopicArn' => String)) do
|
||||
pending if Fog.mocking?
|
||||
body = AWS[:sns].create_topic('fog_topic_tests').body
|
||||
body = Fog::AWS[:sns].create_topic('fog_topic_tests').body
|
||||
@topic_arn = body["TopicArn"]
|
||||
body
|
||||
end
|
||||
|
||||
tests("#list_topics").formats(AWS::SNS::Formats::BASIC.merge('Topics' => [String])) do
|
||||
pending if Fog.mocking?
|
||||
AWS[:sns].list_topics.body
|
||||
Fog::AWS[:sns].list_topics.body
|
||||
end
|
||||
|
||||
tests("#set_topic_attributes('#{@topic_arn}', 'DisplayName', 'other-fog_topic_tests')").formats(AWS::SNS::Formats::BASIC) do
|
||||
pending if Fog.mocking?
|
||||
AWS[:sns].set_topic_attributes(@topic_arn, 'DisplayName', 'other-fog_topic_tests').body
|
||||
Fog::AWS[:sns].set_topic_attributes(@topic_arn, 'DisplayName', 'other-fog_topic_tests').body
|
||||
end
|
||||
|
||||
get_topic_attributes_format = AWS::SNS::Formats::BASIC.merge({
|
||||
|
@ -33,12 +33,12 @@ Shindo.tests('AWS::SES | topic lifecycle tests', ['aws', 'sns']) do
|
|||
|
||||
tests("#get_topic_attributes('#{@topic_arn})").formats(get_topic_attributes_format) do
|
||||
pending if Fog.mocking?
|
||||
AWS[:sns].get_topic_attributes(@topic_arn).body
|
||||
Fog::AWS[:sns].get_topic_attributes(@topic_arn).body
|
||||
end
|
||||
|
||||
tests("#delete_topic('#{@topic_arn}')").formats(AWS::SNS::Formats::BASIC) do
|
||||
pending if Fog.mocking?
|
||||
AWS[:sns].delete_topic(@topic_arn).body
|
||||
Fog::AWS[:sns].delete_topic(@topic_arn).body
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ Shindo.tests('AWS::SQS | message requests', ['aws']) do
|
|||
tests('success') do
|
||||
|
||||
unless Fog.mocking?
|
||||
@queue_url = AWS[:sqs].create_queue('fog_message_tests').body['QueueUrl']
|
||||
@queue_url = Fog::AWS[:sqs].create_queue('fog_message_tests').body['QueueUrl']
|
||||
end
|
||||
|
||||
send_message_format = AWS::SQS::Formats::BASIC.merge({
|
||||
|
@ -13,7 +13,7 @@ Shindo.tests('AWS::SQS | message requests', ['aws']) do
|
|||
|
||||
tests("#send_message('#{@queue_url}', 'message')").formats(send_message_format) do
|
||||
pending if Fog.mocking?
|
||||
AWS[:sqs].send_message(@queue_url, 'message').body
|
||||
Fog::AWS[:sqs].send_message(@queue_url, 'message').body
|
||||
end
|
||||
|
||||
receive_message_format = AWS::SQS::Formats::BASIC.merge({
|
||||
|
@ -33,23 +33,23 @@ Shindo.tests('AWS::SQS | message requests', ['aws']) do
|
|||
|
||||
tests("#receive_message").formats(receive_message_format) do
|
||||
pending if Fog.mocking?
|
||||
data = AWS[:sqs].receive_message(@queue_url).body
|
||||
data = Fog::AWS[:sqs].receive_message(@queue_url).body
|
||||
@receipt_handle = data['Message'].first['ReceiptHandle']
|
||||
data
|
||||
end
|
||||
|
||||
tests("#change_message_visibility('#{@queue_url}, '#{@receipt_handle}', 60)").formats(AWS::SQS::Formats::BASIC) do
|
||||
pending if Fog.mocking?
|
||||
AWS[:sqs].change_message_visibility(@queue_url, @receipt_handle, 60).body
|
||||
Fog::AWS[:sqs].change_message_visibility(@queue_url, @receipt_handle, 60).body
|
||||
end
|
||||
|
||||
tests("#delete_message('#{@queue_url}', '#{@receipt_handle}')").formats(AWS::SQS::Formats::BASIC) do
|
||||
pending if Fog.mocking?
|
||||
AWS[:sqs].delete_message(@queue_url, @receipt_handle).body
|
||||
Fog::AWS[:sqs].delete_message(@queue_url, @receipt_handle).body
|
||||
end
|
||||
|
||||
unless Fog.mocking?
|
||||
AWS[:sqs].delete_queue(@queue_url)
|
||||
Fog::AWS[:sqs].delete_queue(@queue_url)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -8,7 +8,7 @@ Shindo.tests('AWS::SQS | queue requests', ['aws']) do
|
|||
|
||||
tests("#create_queue('fog_queue_tests')").formats(create_queue_format) do
|
||||
pending if Fog.mocking?
|
||||
data = AWS[:sqs].create_queue('fog_queue_tests').body
|
||||
data = Fog::AWS[:sqs].create_queue('fog_queue_tests').body
|
||||
@queue_url = data['QueueUrl']
|
||||
data
|
||||
end
|
||||
|
@ -19,12 +19,12 @@ Shindo.tests('AWS::SQS | queue requests', ['aws']) do
|
|||
|
||||
tests("#list_queues").formats(list_queues_format) do
|
||||
pending if Fog.mocking?
|
||||
AWS[:sqs].list_queues.body
|
||||
Fog::AWS[:sqs].list_queues.body
|
||||
end
|
||||
|
||||
tests("#set_queue_attributes('#{@queue_url}', 'VisibilityTimeout', 60)").formats(AWS::SQS::Formats::BASIC) do
|
||||
pending if Fog.mocking?
|
||||
AWS[:sqs].set_queue_attributes(@queue_url, 'VisibilityTimeout', 60).body
|
||||
Fog::AWS[:sqs].set_queue_attributes(@queue_url, 'VisibilityTimeout', 60).body
|
||||
end
|
||||
|
||||
get_queue_attributes_format = AWS::SQS::Formats::BASIC.merge({
|
||||
|
@ -42,12 +42,12 @@ Shindo.tests('AWS::SQS | queue requests', ['aws']) do
|
|||
|
||||
tests("#get_queue_attributes('#{@queue_url}', 'All')").formats(get_queue_attributes_format) do
|
||||
pending if Fog.mocking?
|
||||
AWS[:sqs].get_queue_attributes(@queue_url, 'All').body
|
||||
Fog::AWS[:sqs].get_queue_attributes(@queue_url, 'All').body
|
||||
end
|
||||
|
||||
tests("#delete_queue('#{@queue_url}')").formats(AWS::SQS::Formats::BASIC) do
|
||||
pending if Fog.mocking?
|
||||
AWS[:sqs].delete_queue(@queue_url).body
|
||||
Fog::AWS[:sqs].delete_queue(@queue_url).body
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
require 'fog'
|
||||
require 'fog/bin'
|
||||
require 'fog/bin' # for available_providers
|
||||
|
||||
require File.expand_path(File.join(File.dirname(__FILE__), 'helpers', 'mock_helper'))
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue