def test_handle_done_5_with_done_true_and_completed_on_in_past_that_completed_on_remains(self): # Completed on shouldn't change if nothing has changed actionitem = ActionItem() actionitem.completed_on = completed_on = random_date() actionitem.done = True actionitem = actionitem.handle_done(actionitem) assert actionitem.completed_on == completed_on
def test_handle_done_3_with_done_set_when_completed_on_has_not_been_set(self): # With actionitem.done set, completed on should be set actionitem = ActionItem() actionitem.done = True actionitem = actionitem.handle_done(actionitem) delta = actionitem.completed_on - datetime.utcnow().replace(tzinfo=utc) assert abs(delta) <= timedelta(milliseconds=10), 'Times are not almost equal'