Esempio n. 1
0
 def test_status_code_returns_the_status_code_of_the_response_object(self):
     action = 'loading'
     object_type = 'case'
     error_params = {'action': action, 'type': object_type}
     response = ExaminationMocks.get_unsuccessful_patient_details_load_response(
     )
     error = GenericError(response, error_params)
     self.assertEqual(error.status_code, response.status_code)
Esempio n. 2
0
 def test_stack_trace_returns_none_if_settings_debug_is_false(self):
     action = 'loading'
     object_type = 'case'
     error_params = {'action': action, 'type': object_type}
     response = ExaminationMocks.get_unsuccessful_patient_details_load_response(
     )
     error = GenericError(response, error_params)
     self.assertEqual(error.stack_trace, None)
Esempio n. 3
0
 def test_get_message_returns_the_base_message_with_the_action_and_object_in(
         self):
     action = 'loading'
     object_type = 'case'
     error_params = {'action': action, 'type': object_type}
     error = GenericError(
         ExaminationMocks.get_unsuccessful_patient_details_load_response(),
         error_params)
     self.assertEqual(error.get_message(),
                      messages.GENERAL_ERROR % (action, object_type))
Esempio n. 4
0
 def test_handle_error_returns_a_not_found_error_if_a_404_passed_in(self):
     response = ExaminationMocks.get_unsuccessful_patient_details_load_response(
     )
     result = handle_error(response, {})
     self.assertEqual(type(result), NotFoundError)