Invalid href

This commit is contained in:
Mouse Reeve 2021-11-14 11:31:47 -08:00
parent 14e2960d06
commit 8612cf654d
2 changed files with 20 additions and 28 deletions

View file

@ -47,7 +47,7 @@
<span class="icon icon-spinner is-pulled-left" aria-hidden="true"></span> <span class="icon icon-spinner is-pulled-left" aria-hidden="true"></span>
<span>{% trans "In progress" %}</span> <span>{% trans "In progress" %}</span>
<span class="is-pulled-right"> <span class="is-pulled-right">
<a href="" class="button is-small">{% trans "Refresh" %}</a> <a href="#" class="button is-small">{% trans "Refresh" %}</a>
</span> </span>
</div> </div>
<div class="is-flex"> <div class="is-flex">

View file

@ -1,5 +1,4 @@
""" testing import """ """ testing import """
from collections import namedtuple
import pathlib import pathlib
from unittest.mock import patch from unittest.mock import patch
import datetime import datetime
@ -104,13 +103,9 @@ class GenericImporter(TestCase):
import_job = self.importer.create_job( import_job = self.importer.create_job(
self.local_user, self.csv, False, "unlisted" self.local_user, self.csv, False, "unlisted"
) )
MockTask = namedtuple("Task", ("id")) with patch("bookwyrm.importers.importer.start_import_task.delay") as mock:
mock_task = MockTask(7)
with patch("bookwyrm.importers.importer.start_import_task.delay") as start:
start.return_value = mock_task
self.importer.start_import(import_job) self.importer.start_import(import_job)
import_job.refresh_from_db() self.assertEqual(mock.call_count, 1)
self.assertEqual(import_job.task_id, "7")
@responses.activate @responses.activate
def test_start_import_task(self, *_): def test_start_import_task(self, *_):
@ -150,28 +145,25 @@ class GenericImporter(TestCase):
import_job = self.importer.create_job( import_job = self.importer.create_job(
self.local_user, self.csv, False, "unlisted" self.local_user, self.csv, False, "unlisted"
) )
item = import_job.items[0] items = import_job.items.all()
item.update_job() for item in items[:3]:
self.assertFalse( item.fail_reason = "hello"
models.Notification.objects.filter( item.save()
user=self.local_user, item.update_job()
related_import=import_job, self.assertFalse(
notification_type="IMPORT", models.Notification.objects.filter(
).exists() user=self.local_user,
) related_import=import_job,
notification_type="IMPORT",
).exists()
)
item = import_job.items[1] item = items[3]
item.update_job() item.fail_reason = "hello"
self.assertFalse( item.save()
models.Notification.objects.filter(
user=self.local_user,
related_import=import_job,
notification_type="IMPORT",
).exists()
)
item = import_job.items[2]
item.update_job() item.update_job()
import_job.refresh_from_db()
self.assertTrue(import_job.complete)
self.assertTrue( self.assertTrue(
models.Notification.objects.filter( models.Notification.objects.filter(
user=self.local_user, user=self.local_user,