Esempio n. 1
0
    def update_task(self, task_id: int, details: Dict):
        details.update({'user': self.user['id']})
        is_valid = self.task_validator.validate(details)

        if is_valid:
            updated_task = TaskService.update_task(task_id, details)
            self.task_list.update_task(task_id, updated_task)
            self._notify_observers()
            return True
        return False
Esempio n. 2
0
 def testUpdateTask(self):
     mock_data = {
         "topic": "Test Update Service",
         "description": "Test Service",
         "start_at": "2019-06-02T06:00:00Z",
         "end_at": "2019-06-02T06:00:00Z",
         "status": True,
         "location": "KMITL",
         "user": 1
     }
     task = TaskService.update_task(26, mock_data)
     self.assertEqual(task.id, 26)
     self.assertEqual(task.topic, mock_data["topic"])
     self.assertEqual(task.description, mock_data["description"])
     self.assertEqual(task.status, mock_data["status"])
     self.assertEqual(task.location, mock_data["location"])