def test_student_did_not_finalize_and_deadline_is_more_than_1_day_away_do_nothing( self): """ test_student_did_not_finalize_and_deadline_is_more_than_1_day_away_do_nothing Given: - there is a student in INFO sent ("INFO level kiment") state - they did not finalize application - finalization deadline has not been spent and is in more than 24 hours When: - clean_info_sent() is called Then: - do nothing """ self.request_handler.expect_request( crmrequestfactory.get_project_list_for_status( INFO_SENT_STATUS_NUMBER), responses_studentlists.INFO_SENT_ONE_STUDENT) self.set_participant_number_expectations() self.request_handler.expect_request( crmrequestfactory.get_student(FAKE_STUDENT_ID_NUMBER), responses_students.FAKE_STUDENT) self.set_participant_number_expectations() clean_info_sent(self.crm_facade)
def test_student_did_not_finalize_deadline_has_spent_more_than_24_hours_ago_delete( self): """ test_student_did_not_finalize_deadline_has_spent_more_than_24_hours_ago_delete Given: - there is a student in INFO sent ("INFO level kiment") state - they did not finalize application - finalization deadline has been spent more than 24 hours ago When: - clean_info_sent() is called Then: - "we deleted you" email is sent - status of student is set to deleted """ self.crm_facade.set_today(datetime.datetime(2019, 1, 24, 12, 0)) self.request_handler.expect_request( crmrequestfactory.get_project_list_for_status( INFO_SENT_STATUS_NUMBER), responses_studentlists.INFO_SENT_ONE_STUDENT) self.set_participant_number_expectations() self.request_handler.expect_request( crmrequestfactory.get_student(FAKE_STUDENT_ID_NUMBER), responses_students.FAKE_STUDENT) self.request_handler.expect_request( crmrequestfactory.set_project_data( FAKE_STUDENT_ID_NUMBER, { u"StatusId": u"2782", u"Levelkuldesek": u"Kezd\u0151 INFO lev\u00e9l, Egy napod van jelentkezni, Ma kell jelentkezni, Toroltunk" }), responses_general.XPUT_RESPONSE) self.set_participant_number_expectations() clean_info_sent(self.crm_facade)
def run(crm_facade): """ Calling this function will execute 3 of the functionalities: - clean_info_sent - handle_waiting_list - register_new_applicants For more details, see the documentation of those. This one is intended to be run frequently, for example once in every 10-15 minutes to make initial feedback faster. Please note that other factors also influence how fast the student gets their first reply. :param crm_facade: the CrmFacade instance this script is using for communication with a MiniCRM system. :type crm_facade: CrmFacade :return: None """ clean_info_sent(crm_facade) handle_waiting_list(crm_facade) register_new_applicants(crm_facade) trace("QUICK SCRIPT EXITED")
def test_student_did_not_finalize_deadline_has_spent_but_not_more_than_24_hours_ago_send_reminder_raise_task( self): """ test_student_did_not_finalize_deadline_has_spent_but_not_more_than_24_hours_ago_send_reminder_raise_task Given: - there is a student in INFO sent ("INFO level kiment") state - they did not finalize application - finalization deadline has been spent, but is within less than 24 hours When: - clean_info_sent() is called Then: - 2nd reminder email ("Egy napod van jelentkezni") is sent - task is raised on the student """ self.crm_facade.set_today(datetime.datetime(2019, 1, 23, 12, 0)) self.request_handler.expect_request( crmrequestfactory.get_project_list_for_status( INFO_SENT_STATUS_NUMBER), responses_studentlists.INFO_SENT_ONE_STUDENT) self.set_participant_number_expectations() self.request_handler.expect_request( crmrequestfactory.get_student(FAKE_STUDENT_ID_NUMBER), responses_students.FAKE_STUDENT) self.request_handler.expect_request( crmrequestfactory.set_project_data( FAKE_STUDENT_ID_NUMBER, { u"Levelkuldesek": u"Kezd\u0151 INFO lev\u00e9l, Egy napod van jelentkezni, Ma kell jelentkezni" }), responses_general.XPUT_RESPONSE) self.set_participant_number_expectations() clean_info_sent(self.crm_facade)