aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_fixtures.py
blob: 2ced3bb5a785713a2b9b3f94b64c815f71bb0eae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

import pytest
import fatcat.api_client
from fixtures import *


def test_rich_app_fixture(rich_app):
    app = rich_app

    assert ChangelogEntry.query.count() == 1

    for cls in (WorkIdent, WorkRev, WorkEdit,
                ContainerIdent, ContainerRev, ContainerEdit,
                CreatorIdent, CreatorRev, CreatorEdit,
                FileIdent, FileRev, FileEdit):
        assert cls.query.count() == 1
    for cls in (ReleaseIdent, ReleaseRev, ReleaseEdit):
        assert cls.query.count() == 2

    for cls in (WorkIdent,
                ContainerIdent,
                CreatorIdent,
                FileIdent):
        assert cls.query.filter(cls.is_live==True).count() == 1
    assert ReleaseIdent.query.filter(ReleaseIdent.is_live==True).count() == 2

    # test that editor's active edit group is now invalid
    editor = Editor.query.first()
    assert editor.active_edit_group == None