예제 #1
0
    def test_write_task(self):
        """Test that the provided entity gets written to the repository."""
        entity = TaskEntity.get_mock_object()

        with self.assertRaises(ResourceNotFoundException):
            TaskService.fetch_task_by_id(entity.id)

        TaskService.write_task(entity)

        self.assertEquals(
            TaskService.fetch_task_by_id(entity.id),
            entity,
        )
예제 #2
0
    def test_fetch_task_by_id(self, mock_fetch):
        """Test that the correct TaskEntity is returned."""
        mock_fetch.return_value = self.url_task

        entity = TaskService.fetch_task_by_id(self.url_task.id)

        self.assertEquals(entity.id, self.url_task.id)