Updates tests

This commit is contained in:
Mouse Reeve 2021-12-29 09:58:42 -08:00
parent 6ca57ae314
commit f9e9dc55d5
2 changed files with 7 additions and 12 deletions

View file

@ -100,13 +100,10 @@ class AnnualSummary(TestCase):
@patch("bookwyrm.activitystreams.add_book_statuses_task.delay")
def test_annual_summary_page(self, *_):
"""there are so many views, this just makes sure it LOADS"""
shelf = self.local_user.shelf_set.filter(identifier="read").first()
models.ShelfBook.objects.create(
book=self.book,
models.ReadThrough.objects.create(
user=self.local_user,
shelf=shelf,
shelved_date=make_date(2020, 1, 1),
book=self.book,
finish_date=make_date(2020, 1, 1)
)
view = views.AnnualSummary.as_view()
@ -132,12 +129,10 @@ class AnnualSummary(TestCase):
book=self.book,
)
shelf = self.local_user.shelf_set.filter(identifier="read").first()
models.ShelfBook.objects.create(
book=self.book,
models.ReadThrough.objects.create(
user=self.local_user,
shelf=shelf,
shelved_date=make_date(2020, 1, 1),
book=self.book,
finish_date=make_date(2020, 1, 1)
)
view = views.AnnualSummary.as_view()

View file

@ -189,7 +189,7 @@ def is_year_available(user, year):
Min("finish_date")
)["finish_date__min"]
if not earliest_year:
return False
return True
earliest_year = earliest_year.year
today = date.today()
year = int(year)