From 9ed7d2300064610bca0d6c62aa6b003a75324105 Mon Sep 17 00:00:00 2001 From: Joel Bradshaw Date: Fri, 27 Nov 2020 18:17:32 -0800 Subject: [PATCH] Test updating a progress Also remove spurious whitespace change --- bookwyrm/models/status.py | 1 + bookwyrm/tests/actions/test_readthrough.py | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/bookwyrm/models/status.py b/bookwyrm/models/status.py index 732cdd62b..b92685da4 100644 --- a/bookwyrm/models/status.py +++ b/bookwyrm/models/status.py @@ -210,6 +210,7 @@ class Quotation(Status): activity_serializer = activitypub.Quotation pure_activity_serializer = activitypub.Note + class Review(Status): ''' a book review ''' name = models.CharField(max_length=255, null=True) diff --git a/bookwyrm/tests/actions/test_readthrough.py b/bookwyrm/tests/actions/test_readthrough.py index 1c5cddb88..ba8c2f007 100644 --- a/bookwyrm/tests/actions/test_readthrough.py +++ b/bookwyrm/tests/actions/test_readthrough.py @@ -58,3 +58,15 @@ class ReadThrough(TestCase): self.assertEqual(len(progress_updates), 1) self.assertEqual(progress_updates[0].mode, models.ProgressMode.PAGE) self.assertEqual(progress_updates[0].progress, 50) + + # Update progress + self.client.post('/edit-readthrough', { + 'id': readthroughs[0].id, + 'pages_read': 100, + }) + + progress_updates = readthroughs[0].progressupdate_set\ + .order_by('updated_date').all() + self.assertEqual(len(progress_updates), 2) + self.assertEqual(progress_updates[1].mode, models.ProgressMode.PAGE) + self.assertEqual(progress_updates[1].progress, 100)