From 57af3351fc2f68c183808163937aef50530a8fe2 Mon Sep 17 00:00:00 2001 From: Marc Aubry Date: Tue, 16 Feb 2016 23:57:58 -0500 Subject: [PATCH] Exception string test --- tests/exceptions_test.py | 9 +++++++++ ubersmith_client/exceptions.py | 2 ++ 2 files changed, 11 insertions(+) create mode 100644 tests/exceptions_test.py diff --git a/tests/exceptions_test.py b/tests/exceptions_test.py new file mode 100644 index 0000000..affb3f1 --- /dev/null +++ b/tests/exceptions_test.py @@ -0,0 +1,9 @@ +import unittest +from ubersmith_client.exceptions import UbersmithException + + +class ExceptionTestTest(unittest.TestCase): + + def test_UbersmithException_has_string_representation(self): + ex = UbersmithException(code=42, message='Wubba Lubba Dub Dub') + self.assertEquals("{0}".format(ex), "Error code 42 - message: Wubba Lubba Dub Dub") diff --git a/ubersmith_client/exceptions.py b/ubersmith_client/exceptions.py index 090ee43..bfb0fd5 100644 --- a/ubersmith_client/exceptions.py +++ b/ubersmith_client/exceptions.py @@ -11,6 +11,8 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. + + class UbersmithException(Exception): code = None message = None