mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-27 03:51:08 +00:00
Fixes review rating serialization
This commit is contained in:
parent
daf65e230d
commit
d61ba2e474
2 changed files with 5 additions and 4 deletions
|
@ -83,4 +83,5 @@ class Rating(Comment):
|
|||
|
||||
rating: int
|
||||
content: str = None
|
||||
name: str = None # not used, but the model inherits from Review
|
||||
type: str = "Rating"
|
||||
|
|
|
@ -129,8 +129,8 @@ class InboxCreate(TestCase):
|
|||
|
||||
def test_create_rating(self):
|
||||
"""a remote rating activity"""
|
||||
models.Edition.objects.create(
|
||||
title="Test Book", origin_id="https://example.com/book/1"
|
||||
book = models.Edition.objects.create(
|
||||
title="Test Book", remote_id="https://example.com/book/1"
|
||||
)
|
||||
activity = self.create_json
|
||||
activity["object"] = {
|
||||
|
@ -160,8 +160,8 @@ class InboxCreate(TestCase):
|
|||
with patch("bookwyrm.activitystreams.ActivityStream.add_status") as redis_mock:
|
||||
views.inbox.activity_task(activity)
|
||||
self.assertTrue(redis_mock.called)
|
||||
rating = models.Status.objects.select_subclasses().first()
|
||||
self.assertEqual(rating.book, self.book)
|
||||
rating = models.ReviewRating.objects.first()
|
||||
self.assertEqual(rating.book, book)
|
||||
self.assertEqual(rating.rating, 3.0)
|
||||
|
||||
def test_create_list(self):
|
||||
|
|
Loading…
Reference in a new issue