forked from mirrors/bookwyrm
Adds import retry test
This commit is contained in:
parent
5deb7d8bba
commit
59ebcc62ee
1 changed files with 17 additions and 0 deletions
|
@ -48,3 +48,20 @@ class ImportViews(TestCase):
|
|||
|
||||
def test_retry_import(self):
|
||||
""" retry failed items """
|
||||
view = views.ImportStatus.as_view()
|
||||
import_job = models.ImportJob.objects.create(
|
||||
user=self.local_user,
|
||||
privacy="unlisted"
|
||||
)
|
||||
request = self.factory.post("")
|
||||
request.user = self.local_user
|
||||
|
||||
with patch("bookwyrm.importers.Importer.start_import"):
|
||||
view(request, import_job.id)
|
||||
|
||||
self.assertEqual(models.ImportJob.objects.count(), 2)
|
||||
retry_job = models.ImportJob.objects.last()
|
||||
|
||||
self.assertTrue(retry_job.retry)
|
||||
self.assertEqual(retry_job.user, self.local_user)
|
||||
self.assertEqual(retry_job.privacy, "unlisted")
|
||||
|
|
Loading…
Reference in a new issue