forked from mirrors/bookwyrm
Fixes default edition ranking test
This commit is contained in:
parent
61785cee66
commit
2fa5fabb7b
1 changed files with 52 additions and 52 deletions
|
@ -43,16 +43,16 @@ class SelfConnector(TestCase):
|
|||
self.assertEqual(result.year, 1980)
|
||||
self.assertEqual(result.connector, self.connector)
|
||||
|
||||
def test_search_rank(self):
|
||||
@patch("bookwyrm.preview_images.generate_edition_preview_image_task.delay")
|
||||
def test_search_rank(self, _):
|
||||
"""prioritize certain results"""
|
||||
author = models.Author.objects.create(name="Anonymous")
|
||||
with patch("bookwyrm.preview_images.generate_edition_preview_image_task.delay"):
|
||||
edition = models.Edition.objects.create(
|
||||
title="Edition of Example Work",
|
||||
published_date=datetime.datetime(1980, 5, 10, tzinfo=timezone.utc),
|
||||
parent_work=models.Work.objects.create(title=""),
|
||||
)
|
||||
# author text is rank C
|
||||
# author text is rank B
|
||||
edition.authors.add(author)
|
||||
|
||||
# series is rank D
|
||||
|
@ -80,9 +80,9 @@ class SelfConnector(TestCase):
|
|||
self.assertEqual(results[1].title, "More Editions")
|
||||
self.assertEqual(results[2].title, "Edition of Example Work")
|
||||
|
||||
def test_search_multiple_editions(self):
|
||||
@patch("bookwyrm.preview_images.generate_edition_preview_image_task.delay")
|
||||
def test_search_multiple_editions(self, _):
|
||||
"""it should get rid of duplicate editions for the same work"""
|
||||
with patch("bookwyrm.preview_images.generate_edition_preview_image_task.delay"):
|
||||
work = models.Work.objects.create(title="Work Title")
|
||||
edition_1 = models.Edition.objects.create(
|
||||
title="Edition 1 Title", parent_work=work
|
||||
|
@ -90,7 +90,7 @@ class SelfConnector(TestCase):
|
|||
edition_2 = models.Edition.objects.create(
|
||||
title="Edition 2 Title",
|
||||
parent_work=work,
|
||||
edition_rank=20, # that's default babey
|
||||
isbn_13="123456789", # this is now the defualt edition
|
||||
)
|
||||
edition_3 = models.Edition.objects.create(title="Fish", parent_work=work)
|
||||
|
||||
|
|
Loading…
Reference in a new issue