def test_convert_events_to_new_format_successful(self): formatted_events = collection_exercise_controller.convert_events_to_new_format( collection_exercise["events"]) self.assertTrue(formatted_events["go_live"] is not None) self.assertTrue(formatted_events["go_live"]["date"] is not None) self.assertTrue( formatted_events["go_live"]["is_in_future"] is not None)
def test_convert_events_to_new_format_successful(self): formatted_events = collection_exercise_controller.convert_events_to_new_format( collection_exercise['events']) self.assertTrue(formatted_events['go_live'] is not None) self.assertTrue(formatted_events['go_live']['date'] is not None) self.assertTrue( formatted_events['go_live']['is_in_future'] is not None)
def test_get_survey_list_details_for_party(self, get_respondent_enrolments, get_collection_exercises, get_cases, get_collection_instrument, calculate_case_status, get_survey, get_business): enrolments = [{ 'business_id': business_party['id'], 'survey_id': survey['id'] }] for collection_exercise_index in collection_exercise_by_survey: if collection_exercise_index['events']: collection_exercise_index[ 'events'] = convert_events_to_new_format( collection_exercise_index['events']) get_respondent_enrolments.return_value = enrolments get_collection_exercises.return_value = collection_exercise_by_survey get_cases.return_value = case_list get_collection_instrument.return_value = collection_instrument_seft calculate_case_status.return_value = 'In Progress' get_survey.return_value = survey get_business.return_value = business_party survey_list = party_controller.get_survey_list_details_for_party( respondent_party['id'], 'todo', business_party['id'], survey['id']) with app.app_context(): for survey_details in survey_list: self.assertTrue(survey_details['case_id'] is not None) self.assertTrue(survey_details['status'] is not None) self.assertTrue( survey_details['collection_instrument_type'] is not None) self.assertTrue(survey_details['survey_id'] is not None) self.assertTrue(survey_details['survey_long_name'] is not None) self.assertTrue( survey_details['survey_short_name'] is not None) self.assertTrue( survey_details['business_party_id'] is not None) self.assertTrue( survey_details['collection_exercise_ref'] is not None)
def test_convert_events_to_new_format_fail(self): events = [{"timestamp": "abc"}] with self.assertRaises(ParseError): collection_exercise_controller.convert_events_to_new_format(events)