コード例 #1
0
    def test_creates_version(self, change_ids):
        p = Person(given_name='John',
                   family_name='Doe',
                   change_id=change_ids.get())
        p.save()
        p.refresh_from_db()

        assert isinstance(p.version, Person.VersionModel)
コード例 #2
0
ファイル: test_shareobject.py プロジェクト: sheriefvt/SHARE
    def test_many_versions(self, change_ids):
        p = Person(given_name='John', family_name='Doe', change_id=change_ids.get())
        p.save()

        names = ['Jane', 'John', 'Jone', 'Jane', 'James', 'Joe', 'Jim', 'Jack', 'Jacklynn']

        for name in names:
            p.given_name = name
            p.change_id = change_ids.get()
            p.save()

        p.refresh_from_db()
        assert p.versions.first() == p.version

        for i, name in enumerate(reversed(['John'] + names)):
            assert p.versions.all()[i].given_name == name
コード例 #3
0
    def test_creates_version(share_source, change_ids):
        p = Person(given_name='John', family_name='Doe', change_id=change_ids.get())
        p.save()
        p.refresh_from_db()

        assert isinstance(p.version, Person.VersionModel)