Skip to content
Snippets Groups Projects
Commit 1af7531f authored by Auke Klazema's avatar Auke Klazema
Browse files

SW-609: Fix Exception.message issue in t_specification_service.py

parent 908c88a3
No related branches found
No related tags found
No related merge requests found
......@@ -523,7 +523,7 @@ class TestSpecificationHandler(unittest.TestCase):
with self.assertRaises(Exception) as exception:
self.handler.add_specification("user", self.xml)
self.assertEqual(exception.exception.message, "Invalid specification: error message")
self.assertEqual(str(exception.exception), "Invalid specification: error message")
def test_add_specification_should_raise_exception_when_spec_does_not_start_correctly(self):
wrong_root_xml = "<xml></xml>"
......@@ -540,7 +540,7 @@ class TestSpecificationHandler(unittest.TestCase):
with self.assertRaises(Exception) as exception:
self.handler.add_specification("user", self.xml)
self.assertEqual(exception.exception.message, "Innermost folder already exists: /LC7_030/TARGET_A/AARTFAAC-TRIGGERED/")
self.assertEqual(str(exception.exception), "Innermost folder already exists: /LC7_030/TARGET_A/AARTFAAC-TRIGGERED/")
def test_add_specificaiotn_should_raise_exception_when_project_is_not_active(self):
self.momqueryrpc_mock.isProjectActive.return_value = {"active": False}
......@@ -548,7 +548,7 @@ class TestSpecificationHandler(unittest.TestCase):
with self.assertRaises(Exception) as exception:
self.handler.add_specification("user", self.xml)
self.assertEqual(exception.exception.message, "Project is not active: LC7_030")
self.assertEqual(str(exception.exception), "Project is not active: LC7_030")
def test_Add_specification_should_raise_exception_when_activity_has_no_status_field(self):
missing_status_xml = self.xml
......@@ -558,7 +558,7 @@ class TestSpecificationHandler(unittest.TestCase):
with self.assertRaises(Exception) as exception:
self.handler.add_specification("user", missing_status_xml)
self.assertEqual("Activity has no status: ('0', '200')", exception.exception.message)
self.assertEqual("Activity has no status: ('0', '200')", str(exception.exception))
# TODO test raise Exception("Specified action has to be in folder:
......@@ -570,7 +570,7 @@ class TestSpecificationHandler(unittest.TestCase):
with self.assertRaises(Exception) as exception:
self.handler.add_specification("user", unpermitted_action_xml)
self.assertTrue(exception.exception.message.startswith("Specified activity is not permitted: ('0', '200')"))
self.assertTrue(str(exception.exception).startswith("Specified activity is not permitted: ('0', '200')"))
def test_add_specification_should_raise_exception_when_activity_has_state_other_then_opened_or_approved(self):
wrong_status_xml = self.xml
......@@ -580,7 +580,7 @@ class TestSpecificationHandler(unittest.TestCase):
with self.assertRaises(Exception) as exception:
self.handler.add_specification("user", wrong_status_xml)
self.assertEqual("Specified activity is not going to permitted status: ('0', '200') -> 'prescheduled' not in ['opened', 'approved']", exception.exception.message)
self.assertEqual("Specified activity is not going to permitted status: ('0', '200') -> 'prescheduled' not in ['opened', 'approved']", str(exception.exception))
def test_add_specification_should_ask_for_observation_authentication_when_jobtype_is_measurement(self):
self.handler.add_specification("user", self.xml)
......@@ -598,7 +598,7 @@ class TestSpecificationHandler(unittest.TestCase):
with self.assertRaises(Exception) as exception:
self.handler.add_specification("user", self.xml)
self.assertEqual("Invalid MoM specification: error message", exception.exception.message)
self.assertEqual("Invalid MoM specification: error message", str(exception.exception))
def test_add_specification_should_send_correctly_translated_spec_to_mom(self):
self.handler.add_specification("user", self.xml)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment