Merge branch 'main' into opengraph-image-generation

This commit is contained in:
Mouse Reeve
2021-06-17 15:17:54 -07:00
committed by GitHub
86 changed files with 2188 additions and 1834 deletions

View File

@ -35,7 +35,7 @@ class ReadThrough(TestCase):
self.assertEqual(self.edition.readthrough_set.count(), 0)
self.client.post(
"/start-reading/{}".format(self.edition.id),
"/reading-status/start/{}".format(self.edition.id),
{
"start_date": "2020-11-27",
},
@ -56,10 +56,9 @@ class ReadThrough(TestCase):
self.assertEqual(self.edition.readthrough_set.count(), 0)
self.client.post(
"/start-reading/{}".format(self.edition.id),
"/reading-status/start/{}".format(self.edition.id),
{
"start_date": "2020-11-27",
"progress": 50,
},
)
@ -68,15 +67,8 @@ class ReadThrough(TestCase):
self.assertEqual(
readthroughs[0].start_date, datetime(2020, 11, 27, tzinfo=timezone.utc)
)
self.assertEqual(readthroughs[0].progress, 50)
self.assertEqual(readthroughs[0].finish_date, None)
progress_updates = readthroughs[0].progressupdate_set.all()
self.assertEqual(len(progress_updates), 1)
self.assertEqual(progress_updates[0].mode, models.ProgressMode.PAGE)
self.assertEqual(progress_updates[0].progress, 50)
self.assertEqual(delay_mock.call_count, 1)
# Update progress
self.client.post(
"/edit-readthrough",
@ -89,9 +81,9 @@ class ReadThrough(TestCase):
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)
self.assertEqual(len(progress_updates), 1)
self.assertEqual(progress_updates[0].mode, models.ProgressMode.PAGE)
self.assertEqual(progress_updates[0].progress, 100)
# Edit doesn't publish anything
self.assertEqual(delay_mock.call_count, 1)