def test_method_delete(self): work_task_repo = WorkTaskRepo() work_task = WorkTask( title='Test Work Task', description='Test method create', paid=False, price=100, project_id=self.project.id, completed=True, ) work_task_create = work_task_repo.create(work_task) self.assertIsNotNone(work_task_repo.get(work_task_create.id)) self.assertIsNotNone(WorkTaskORM.objects.get(id=work_task_create.id)) work_task_delete = work_task_repo.delete(work_task_create.id) with self.assertRaises(EntityDoesNotExistException): work_task_repo.get(work_task_create.id) with self.assertRaises(WorkTaskORM.DoesNotExist): WorkTaskORM.objects.get(id=work_task_create.id) self.assertEqual(work_task_delete.title, 'Test Work Task') self.assertEqual(work_task_delete.description, 'Test method create') self.assertEqual(work_task_delete.paid, False) self.assertEqual(work_task_delete.completed, True) self.assertEqual(work_task_delete.project_id, self.project.id) self.assertEqual(work_task_delete.price, 100)
def test_method_get(self): work_task_repo = WorkTaskRepo() work_task = WorkTask( title='Test Work Task', description='Test method create', paid=False, price=100, project_id=self.project.id, completed=True, ) work_task_create = work_task_repo.create(work_task) work_task_get = work_task_repo.get(work_task_create.id) self.assertEqual(work_task_get.title, work_task_create.title) self.assertEqual(work_task_get.description, work_task_create.description) self.assertEqual(work_task_get.paid, work_task_create.paid) self.assertEqual(work_task_get.completed, work_task_create.completed) self.assertEqual(work_task_get.project_id, work_task_create.project_id) self.assertEqual(work_task_get.price, work_task_create.price) with self.assertRaises(EntityDoesNotExistException): work_task_repo.get(work_task_create.id + 56165156)