mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-10 10:59:30 +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
|
rating: int
|
||||||
content: str = None
|
content: str = None
|
||||||
|
name: str = None # not used, but the model inherits from Review
|
||||||
type: str = "Rating"
|
type: str = "Rating"
|
||||||
|
|
|
@ -129,8 +129,8 @@ class InboxCreate(TestCase):
|
||||||
|
|
||||||
def test_create_rating(self):
|
def test_create_rating(self):
|
||||||
"""a remote rating activity"""
|
"""a remote rating activity"""
|
||||||
models.Edition.objects.create(
|
book = models.Edition.objects.create(
|
||||||
title="Test Book", origin_id="https://example.com/book/1"
|
title="Test Book", remote_id="https://example.com/book/1"
|
||||||
)
|
)
|
||||||
activity = self.create_json
|
activity = self.create_json
|
||||||
activity["object"] = {
|
activity["object"] = {
|
||||||
|
@ -160,8 +160,8 @@ class InboxCreate(TestCase):
|
||||||
with patch("bookwyrm.activitystreams.ActivityStream.add_status") as redis_mock:
|
with patch("bookwyrm.activitystreams.ActivityStream.add_status") as redis_mock:
|
||||||
views.inbox.activity_task(activity)
|
views.inbox.activity_task(activity)
|
||||||
self.assertTrue(redis_mock.called)
|
self.assertTrue(redis_mock.called)
|
||||||
rating = models.Status.objects.select_subclasses().first()
|
rating = models.ReviewRating.objects.first()
|
||||||
self.assertEqual(rating.book, self.book)
|
self.assertEqual(rating.book, book)
|
||||||
self.assertEqual(rating.rating, 3.0)
|
self.assertEqual(rating.rating, 3.0)
|
||||||
|
|
||||||
def test_create_list(self):
|
def test_create_list(self):
|
||||||
|
|
Loading…
Reference in a new issue