Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(957)

Unified Diff: server/guiserver/tests/bundles/test_utils.py

Issue 34270044: Extract the message from EnvError on deploy err.
Patch Set: Extract the message from EnvError on deploy err. Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « server/guiserver/tests/bundles/test_base.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: server/guiserver/tests/bundles/test_utils.py
=== modified file 'server/guiserver/tests/bundles/test_utils.py'
--- server/guiserver/tests/bundles/test_utils.py 2013-11-19 15:28:56 +0000
+++ server/guiserver/tests/bundles/test_utils.py 2013-11-27 19:28:03 +0000
@@ -32,7 +32,7 @@
from guiserver import watchers
from guiserver.bundles import utils
from guiserver.tests import helpers
-
+from jujuclient import EnvError
mock_time = mock.patch('time.time', mock.Mock(return_value=12345))
@@ -93,6 +93,17 @@
error = utils.message_from_error(ValueError('bad wolf'))
self.assertEqual('bad wolf', error)
+ def test_env_error_extracted(self):
+ # An EnvError as returned from the Go environment is not suitable for
+ # display to the user. The Error field is extracted and returned.
+ expected_type = "error type: <class 'jujuclient.EnvError'>"
+ expected_message = 'error message: cannot parse json'
+ with ExpectLog('', expected_type, required=True):
+ with ExpectLog('', expected_message, required=True):
+ exception = EnvError({'Error': 'cannot parse json'})
+ error = utils.message_from_error(exception)
+ self.assertEqual('cannot parse json', error)
+
def test_without_message(self):
# A placeholder message is returned.
expected_type = "error type: <type 'exceptions.SystemExit'>"
« no previous file with comments | « server/guiserver/tests/bundles/test_base.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b