def test_get_user_rating(self, _): """get a user's most recent rating of a book""" with patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay"): models.Review.objects.create(user=self.user, book=self.book, rating=3) self.assertEqual(bookwyrm_tags.get_user_rating(self.book, self.user), 3)
def test_get_user_rating_doesnt_exist(self, _): """there is no rating available""" self.assertEqual(bookwyrm_tags.get_user_rating(self.book, self.user), 0)