From c3608d7d93142c34005b65c123cc4e4b6c5b4737 Mon Sep 17 00:00:00 2001 From: Michael Hale Date: Mon, 3 Dec 2012 10:43:01 -0500 Subject: [PATCH 1/3] [aws|auto_scaling] Implement resume_processes mock --- lib/fog/aws/requests/auto_scaling/resume_processes.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/fog/aws/requests/auto_scaling/resume_processes.rb b/lib/fog/aws/requests/auto_scaling/resume_processes.rb index f66eef881..bd653fc33 100644 --- a/lib/fog/aws/requests/auto_scaling/resume_processes.rb +++ b/lib/fog/aws/requests/auto_scaling/resume_processes.rb @@ -40,7 +40,16 @@ module Fog class Mock def resume_processes(auto_scaling_group_name, options = {}) - Fog::Mock.not_implemented + unless self.data[:auto_scaling_groups].has_key?(auto_scaling_group_name) + raise Fog::AWS::AutoScaling::ValidationError.new("AutoScalingGroup name not found - no such group: #{auto_scaling_group_name}") + end + + response = Excon::Response.new + response.status = 200 + response.body = { + 'ResponseMetadata' => { 'RequestId' => Fog::AWS::Mock.request_id } + } + response end end From 2572d8381f7c28de2c66a05ce2f8ffeb5f97a835 Mon Sep 17 00:00:00 2001 From: Michael Hale Date: Mon, 3 Dec 2012 10:48:42 -0500 Subject: [PATCH 2/3] [aws|auto_scaling] Implement suspend_processes mock --- lib/fog/aws/requests/auto_scaling/suspend_processes.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/fog/aws/requests/auto_scaling/suspend_processes.rb b/lib/fog/aws/requests/auto_scaling/suspend_processes.rb index 9c623a3a3..68edf0f7c 100644 --- a/lib/fog/aws/requests/auto_scaling/suspend_processes.rb +++ b/lib/fog/aws/requests/auto_scaling/suspend_processes.rb @@ -44,10 +44,15 @@ module Fog def suspend_processes(auto_scaling_group_name, options = {}) unless self.data[:auto_scaling_groups].has_key?(auto_scaling_group_name) - raise Fog::AWS::AutoScaling::ValidationError.new('AutoScalingGroup name not found - null') + raise Fog::AWS::AutoScaling::ValidationError.new("AutoScalingGroup name not found - no such group: #{auto_scaling_group_name}") end - Fog::Mock.not_implemented + response = Excon::Response.new + response.status = 200 + response.body = { + 'ResponseMetadata' => { 'RequestId' => Fog::AWS::Mock.request_id } + } + response end end From 37602b147cfd45e46e25fe7b1412516b488ad78a Mon Sep 17 00:00:00 2001 From: Michael Hale Date: Mon, 3 Dec 2012 13:19:47 -0500 Subject: [PATCH 3/3] [aws|auto_scaling] remove pending if mocking? for model_tests --- tests/aws/requests/auto_scaling/model_tests.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/aws/requests/auto_scaling/model_tests.rb b/tests/aws/requests/auto_scaling/model_tests.rb index ab813ecfe..be07e1e36 100644 --- a/tests/aws/requests/auto_scaling/model_tests.rb +++ b/tests/aws/requests/auto_scaling/model_tests.rb @@ -1,8 +1,6 @@ Shindo.tests('AWS::AutoScaling | model_tests', ['aws', 'auto_scaling']) do tests('success') do - pending if Fog.mocking? - lc = nil lc_id = 'fog-model-lc' @@ -62,7 +60,7 @@ Shindo.tests('AWS::AutoScaling | model_tests', ['aws', 'auto_scaling']) do tests('suspend processes') do asg.suspend_processes() - #tests('processes suspended').returns([]) { asg.suspended_processes } + tests('processes suspended').returns([]) { asg.suspended_processes } end tests('resume processes') do