mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-23 08:36:32 +00:00
Another mock
This commit is contained in:
parent
141d3aa813
commit
b64f0511a5
1 changed files with 4 additions and 1 deletions
|
@ -1,4 +1,5 @@
|
|||
""" test for app action functionality """
|
||||
from collections import namedtuple
|
||||
from unittest.mock import patch
|
||||
from django.template.response import TemplateResponse
|
||||
from django.test import TestCase
|
||||
|
@ -49,7 +50,9 @@ class ImportTroubleshootViews(TestCase):
|
|||
request = self.factory.post("")
|
||||
request.user = self.local_user
|
||||
|
||||
with patch("bookwyrm.importers.Importer.start_import"):
|
||||
MockTask = namedtuple("Task", ("id"))
|
||||
with patch("bookwyrm.models.import_job.start_import_task.delay") as mock:
|
||||
mock.return_value = MockTask(123)
|
||||
view(request, import_job.id)
|
||||
|
||||
self.assertEqual(models.ImportJob.objects.count(), 2)
|
||||
|
|
Loading…
Reference in a new issue