From bbc05578fbf666283849fb78d0ddf8d03e446952 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Tue, 2 Feb 2021 14:59:40 -0800 Subject: [PATCH] Fixes tests --- bookwyrm/activitypub/ordered_collection.py | 2 +- bookwyrm/models/user.py | 3 ++- bookwyrm/tests/models/test_list.py | 2 +- bookwyrm/tests/models/test_shelf_model.py | 2 +- bookwyrm/tests/models/test_user_model.py | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/bookwyrm/activitypub/ordered_collection.py b/bookwyrm/activitypub/ordered_collection.py index fea793cf..cf642994 100644 --- a/bookwyrm/activitypub/ordered_collection.py +++ b/bookwyrm/activitypub/ordered_collection.py @@ -30,7 +30,7 @@ class BookList(OrderedCollectionPrivate): ''' structure of an ordered collection activity ''' summary: str = None curation: str = 'closed' - type: str = 'List' + type: str = 'BookList' @dataclass(init=False) diff --git a/bookwyrm/models/user.py b/bookwyrm/models/user.py index 79d11206..3fd0eaf7 100644 --- a/bookwyrm/models/user.py +++ b/bookwyrm/models/user.py @@ -131,7 +131,7 @@ class User(OrderedCollectionPageMixin, AbstractUser): privacy__in=['public', 'unlisted'], ).select_subclasses().order_by('-published_date') return self.to_ordered_collection(queryset, \ - remote_id=self.outbox, **kwargs) + collection_only=True, remote_id=self.outbox, **kwargs) def to_following_activity(self, **kwargs): ''' activitypub following list ''' @@ -266,6 +266,7 @@ class AnnualGoal(BookWyrmModel): @property def progress_percent(self): + ''' how close to your goal, in percent form ''' return int(float(self.book_count / self.goal) * 100) diff --git a/bookwyrm/tests/models/test_list.py b/bookwyrm/tests/models/test_list.py index ce7b1867..ee60a029 100644 --- a/bookwyrm/tests/models/test_list.py +++ b/bookwyrm/tests/models/test_list.py @@ -27,7 +27,7 @@ class List(TestCase): self.assertIsInstance(activity_json, dict) self.assertEqual(activity_json['id'], self.list.remote_id) self.assertEqual(activity_json['totalItems'], 0) - self.assertEqual(activity_json['type'], 'OrderedCollection') + self.assertEqual(activity_json['type'], 'BookList') self.assertEqual(activity_json['name'], 'Test List') self.assertEqual(activity_json['owner'], self.user.remote_id) diff --git a/bookwyrm/tests/models/test_shelf_model.py b/bookwyrm/tests/models/test_shelf_model.py index 2bce0a9c..70394a12 100644 --- a/bookwyrm/tests/models/test_shelf_model.py +++ b/bookwyrm/tests/models/test_shelf_model.py @@ -26,6 +26,6 @@ class Shelf(TestCase): self.assertIsInstance(activity_json, dict) self.assertEqual(activity_json['id'], self.shelf.remote_id) self.assertEqual(activity_json['totalItems'], 0) - self.assertEqual(activity_json['type'], 'OrderedCollection') + self.assertEqual(activity_json['type'], 'Shelf') self.assertEqual(activity_json['name'], 'Test Shelf') self.assertEqual(activity_json['owner'], self.user.remote_id) diff --git a/bookwyrm/tests/models/test_user_model.py b/bookwyrm/tests/models/test_user_model.py index b7a41eab..a10c89b8 100644 --- a/bookwyrm/tests/models/test_user_model.py +++ b/bookwyrm/tests/models/test_user_model.py @@ -10,7 +10,7 @@ class User(TestCase): def setUp(self): self.user = models.User.objects.create_user( 'mouse@%s' % DOMAIN, 'mouse@mouse.mouse', 'mouseword', - local=True, localname='mouse') + local=True, localname='mouse', name='hi') def test_computed_fields(self): ''' username instead of id here '''