On 27/01/12 12:28 +0100, mzatko(a)redhat.com wrote:
From: Maros Zatko <mzatko(a)redhat.com>
https://bugzilla.redhat.com/show_bug.cgi?id=749376
Test for descriptive messages for exceptions when Conductor is
unreachable
---
Exactly what I was hoping for, thanks for adding these tests.
-j
spec/command/base_command_spec.rb | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/spec/command/base_command_spec.rb b/spec/command/base_command_spec.rb
index 26b044b..8c1ef5f 100644
--- a/spec/command/base_command_spec.rb
+++ b/spec/command/base_command_spec.rb
@@ -86,6 +86,29 @@ module Aeolus
$stdout.string.should include("Invalid Credentials, please check
~/.aeolus-cli")
end
end
+
+ it "should display message when Found response is returned from
Conductor" do
+ resp = mock(:header => {'Location' => 'site'})
+ e = ActiveResource::Redirection.new(resp)
+ lambda {base_command.send(:handle_exception, e)}.should
raise_error(SystemExit)
+
+ $stdout.string.should include("Server tried to redirect to
#{e.response.header['location']}, please check ~/.aeolus-cli")
+ end
+
+ it "should display message when Conductor is not running" do
+ resp = mock(:header => {'Location' => 'site'})
+ e = ActiveResource::ServerError.new(resp)
+ lambda {base_command.send(:handle_exception, e)}.should
raise_error(SystemExit)
+
+ $stdout.string.should include("Please check that Conductor is
running.")
+ end
+
+ it "should display message when there is incorrect hostname in
.aeolus-cli" do
+ e = SocketError.new
+ lambda {base_command.send(:handle_exception, e)}.should
raise_error(SystemExit)
+
+ $stdout.string.should include("Please check your ~/.aeolus-cli")
+ end
end
end
--
1.7.7.6