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

View file

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