def force_submission_expire(self): sub_list = yield cleaning_sched.get_tiptime_by_marker(models.InternalTip._marker[0]) self.assertEqual(len(sub_list), 1) sub_desc = sub_list[0] sub_desc['submission_life_seconds'] = 0 self.assertTrue( is_expired( cleaning_sched.iso2dateobj(sub_desc['creation_date']), sub_desc['submission_life_seconds']) ) # and then, delete the expired submission yield cleaning_sched.itip_cleaning(sub_desc['id']) new_list = yield cleaning_sched.get_tiptime_by_marker(models.InternalTip._marker[0]) self.assertEqual(len(new_list), 0)
def postpone_tip_expiration(self): recv_desc = yield admin.get_receiver_list() self.assertEqual(len(recv_desc), 2) rtip_desc = yield receiver.get_receiver_tip_list(recv_desc[0]['id']) self.assertEqual(len(rtip_desc), 1) tip_list = yield cleaning_sched.get_tiptime_by_marker(models.InternalTip._marker[2]) self.assertEqual(len(tip_list), 1) rtip.postpone_expiration_date(recv_desc[0]['id'], rtip_desc[0]['id']) yield cleaning_sched.CleaningSchedule().operation()
def tip_not_expired(self): """ Tip is intended InternalTip notified and delivered (marker 2, 'first' layer of deliverance) and their life depends by context policies """ tip_list = yield cleaning_sched.get_tiptime_by_marker(models.InternalTip._marker[2]) self.assertEqual(len(tip_list), 1) self.assertFalse( is_expired( cleaning_sched.iso2dateobj(tip_list[0]['creation_date']), tip_list[0]['tip_life_seconds']) )
def submission_not_expired(self): """ Submission is intended the non-finalized Tip, with a shorter life than completed Tips, and not yet delivered to anyone. (marker 0) """ sub_list = yield cleaning_sched.get_tiptime_by_marker(models.InternalTip._marker[0]) self.assertEqual(len(sub_list), 1) self.assertFalse( is_expired( cleaning_sched.iso2dateobj(sub_list[0]['creation_date']), sub_list[0]['submission_life_seconds']) )