Skip to content

Commit

Permalink
Revised test to check database entry for preview_image column before/…
Browse files Browse the repository at this point in the history
…after function call
  • Loading branch information
anishTP committed Nov 10, 2023
1 parent 0d613a0 commit 81329b2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 18 deletions.
6 changes: 0 additions & 6 deletions funnel/views/thumbnails.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 4 additions & 12 deletions tests/unit/views/preview_image_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 81329b2

Please sign in to comment.