Skip to content

Commit

Permalink
Add test for existing ReadThrough database constraints
Browse files Browse the repository at this point in the history
  • Loading branch information
dato committed Nov 13, 2023
1 parent 766e31c commit 009c290
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions bookwyrm/tests/models/test_readthrough_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from unittest.mock import patch
from django.test import TestCase
from django.core.exceptions import ValidationError
from django.db import IntegrityError
from django.utils import timezone

from bookwyrm import models
Expand Down Expand Up @@ -46,6 +47,12 @@ def test_valid_dates(self):
self._assert_create(start, start + datetime.timedelta(days=1))
self._assert_create(start, start)

def test_chronology_constraint(self):
"""finish_date >= start_date"""
start = timezone.now()
with self.assertRaises(IntegrityError):
self._assert_create(start, start - datetime.timedelta(days=2))


class ReadThroughProgressUpdates(ReadThroughTestBase):
"""test ProgressUpdate creation from ReadThrough objects"""
Expand Down

0 comments on commit 009c290

Please sign in to comment.