예제 #1
0
 def convert_and_create_one_report(self, live_report_dict):
     """
     Loading report dict to LiveReport Object
     Converts live_report to converted_live_report
     Creates converted_report to db
     :param live_report_dict:
     :return: create_response: CreateResponse, was_created_successfully: bool
     """
     parsed_report = LiveReport.load_live_report(live_report_dict)
     converted_report = ReportConverter.convert_live_report(parsed_report)
     create_response = self.create_one_report_to_databases(converted_report)
     return create_response, create_response.errors_count == self.no_errors_occurred
예제 #2
0
 def test_convert_live_report_subtype_not_defined(self):
     self.live_report.report_text.data_type = 'NOT_DEFINED_TEST'
     converter_report = ReportConverter.convert_live_report(
         self.live_report)
     self.assertEqual(converter_report.report_text.subtype, 'minor')
예제 #3
0
 def test_convert_live_report_subtype_crash_minor(self):
     self.live_report.report_text.data_type = 'ACCIDENT'
     self.live_report.report_text.subtype = 'ACCIDENT_MINOR'
     converter_report = ReportConverter.convert_live_report(
         self.live_report)
     self.assertEqual(converter_report.report_text.subtype, 'minor')
예제 #4
0
 def test_convert_live_report_data_type_undefined(self):
     self.live_report.report_text.data_type = 'NOT_DEFINED_TEST'
     converter_report = ReportConverter.convert_live_report(
         self.live_report)
     self.assertEqual(converter_report.report_text.data_type, 'incident')
예제 #5
0
 def test_convert_live_report_data_type_all_other(self):
     self.live_report.report_text.data_type = 'ALL_OTHER'
     converter_report = ReportConverter.convert_live_report(
         self.live_report)
     self.assertEqual(converter_report.report_text.data_type, 'incident')
예제 #6
0
 def test_convert_live_report_data_type_accident(self):
     self.live_report.report_text.data_type = 'ACCIDENT'
     converter_report = ReportConverter.convert_live_report(
         self.live_report)
     self.assertEqual(converter_report.report_text.data_type, 'crash')
 def setUp(self):
     report_dict_raw = get_mock_report()
     live_report = LiveReport.load_live_report(report_dict_raw)
     self.converted_report = ReportConverter.convert_live_report(
         live_report)