Beispiel #1
0
 def testGetTask(self):
     task = Task(mock_task_data)
     tasks = [
         mock_task_data,
         mock_task_data.copy(),
         mock_task_data.copy()
     ]
     task_list = TaskList(tasks)
     result = task_list.get_task(task.id)
     self.assertEqual(result, task)
Beispiel #2
0
 def testDeleteTask(self):
     task = Task(mock_task_data)
     mock_task_data_2 = mock_task_data.copy()
     mock_task_data_3 = mock_task_data.copy()
     mock_task_data_2['id'] = 1
     mock_task_data_3['id'] = 2
     tasks = [
         mock_task_data,
         mock_task_data_2,
         mock_task_data_3
     ]
     task_list = TaskList(tasks)
     task_list.delete_task(1)
     self.assertEqual(task_list.get_task(1), None)
Beispiel #3
0
    def testUpdateTask(self):
        task = Task(mock_task_data)
        mock_task_data_2 = mock_task_data.copy()
        mock_task_data_3 = mock_task_data.copy()
        mock_task_data_2['id'] = 1
        mock_task_data_3['id'] = 2
        tasks = [
            mock_task_data,
            mock_task_data_2,
            mock_task_data_3
        ]
        task_list = TaskList(tasks)
        new_data = mock_task_data.copy()
        new_data['topic'] = "hello world"
        result = task_list.update_task(task.id, new_data)

        self.assertEqual(result.topic, "hello world")
        self.assertEqual(result, task_list.get_task(task.id))