def test_edit_task_completed_status_db(self): """ Tests if a task completed status is edited successfully with the right information """ task_before = db.get_task(1, 1) db.update_task_completed(1, 1, 1) task_after = db.get_task(1, 1) self.assertEqual(task_after['id'], task_before['id']) self.assertEqual(task_after['project_id'], task_before['project_id']) self.assertEqual(task_after['title'], task_before['title']) self.assertEqual(task_after['creation_date'], task_before['creation_date']) self.assertEqual(task_after['completed'], 1)
def test_get_task_db(self): """ Tests the return of an existing task """ task = db.get_task(1, 1) self.assertEqual(task['id'], 1) self.assertEqual(task['project_id'], 1) self.assertEqual(task['title'], 'Search for doughnuts') self.assertEqual(task['creation_date'], '2020-05-05') self.assertEqual(task['completed'], 1)
def test_insert_task_db(self): """ Tests if a task is created successfully with the right information """ mocktask = self.create_mock_task(1, 'test', '20-12-2020', 0) db.insert_task(mocktask['proj_id'], mocktask) task = db.get_task(9, 1) self.assertEqual(task['id'], 9) self.assertEqual(task['project_id'], mocktask['proj_id']) self.assertEqual(task['title'], mocktask['title']) self.assertEqual(task['creation_date'], mocktask['creation_date']) self.assertEqual(task['completed'], mocktask['completed'])
def test_delete_task_db(self): """ Tests if a task is deleted successfully """ db.delete_task(1, 1) task = db.get_task(1, 1) self.assertEqual(task, None)