예제 #1
0
    def test__get_latest_revision(self):
        timestamp = datetime(2020, 1, 1, 1, 1, 1)
        timestamp_latest = datetime(2020, 2, 1, 1, 1, 1)

        revision = Revision(id=1,
                            content='hello',
                            timestamp=timestamp,
                            document_id=5)

        revision_latest = Revision(id=2,
                                   content='hello again',
                                   timestamp=timestamp_latest,
                                   document_id=5)

        document = Document(id=5,
                            title='blah',
                            revisions=[revision, revision_latest])

        assert document.get_latest_revision() == revision_latest