From 81329b267ce40c76a9ad02347b5e4dbad8588334 Mon Sep 17 00:00:00 2001 From: anishTP Date: Fri, 10 Nov 2023 12:40:06 +0530 Subject: [PATCH] Revised test to check database entry for preview_image column before/after function call --- funnel/views/thumbnails.py | 6 ------ tests/unit/views/preview_image_test.py | 16 ++++------------ 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/funnel/views/thumbnails.py b/funnel/views/thumbnails.py index f9a95e363..7165648ac 100644 --- a/funnel/views/thumbnails.py +++ b/funnel/views/thumbnails.py @@ -22,12 +22,6 @@ def redo_project_preview_image(project: Project) -> None: @rqjob() def render_project_preview_image(project_id: int) -> None: """Generate a project preview image.""" - -# task_queue = rq.get_queue() -# for job in task_queue.jobs: -# if job.get_id() is job_id: -# return - project = Project.query.get(project_id) if project is None: return diff --git a/tests/unit/views/preview_image_test.py b/tests/unit/views/preview_image_test.py index 819223f4e..9ad1c94c2 100644 --- a/tests/unit/views/preview_image_test.py +++ b/tests/unit/views/preview_image_test.py @@ -2,16 +2,8 @@ from funnel.views.thumbnails import render_project_preview_image -@pytest.mark.usefixtures('app_context', 'project_expo2011') -@pytest.fixture() -def add_tasks_to_queue(project_expo2011): - from funnel import rq - rq.job_class = 'rq.job.Job' - rq.queues = ['funnel_testing'] - return render_project_preview_image.queue(project_id=project_expo2011.id) - -@pytest.mark.usefixtures('add_tasks_to_queue', 'project_expo2011', 'project_ai1', - 'all_fixtures') -def test_preview_image_jobs(project_expo2011, project_ai1): +@pytest.mark.usefixtures('project_expo2011', 'all_fixtures') +def test_preview_image_jobs(project_expo2011): + assert project_expo2011.preview_image is None + render_project_preview_image(project_id=project_expo2011.id) assert project_expo2011.preview_image is not None - assert project_ai1.preview_image is None