def test_updates_task_plan(self): new_interval = 500 new_datetime = datetime.datetime.now() task_plan_with_id = self.task_plan_storage.create(self.task_plan) task_plan_with_id.interval = new_interval task_plan_with_id.last_created_at = new_datetime self.task_plan_storage.update(task_plan_with_id) task_plan_from_db = TaskPlan.get(TaskPlan.id == task_plan_with_id.id) self.assertEqual(task_plan_from_db.interval, new_interval) self.assertEqual(task_plan_from_db.last_created_at, new_datetime)
def get_by_id(self, plan_id): try: return self.to_plan_instance(TaskPlan.get(TaskPlan.id == plan_id)) except DoesNotExist: return None