Пример #1
0
def test_create_unique_proj_name(asset):
    # Expecting IntegrityError error "Duplicate entry..."
    try:
        Asset.create(name=asset.name, project=asset.project, kind=asset.kind)
    except IntegrityError:
        return
    raise AssertionError('Expected IntegrityError due to "Duplicate entry"')
Пример #2
0
def asset_library(project):
    try:
        return Asset.find_one(project=project,
                              name='camera',
                              kind='camera',
                              library=True)
    except NoResultFound:
        return Asset.create(project=project,
                            name='camera',
                            kind='camera',
                            library=True)
Пример #3
0
def asset(project):
    try:
        return Asset.find_one(project=project, name='cupcake', kind='prop')
    except NoResultFound:
        return Asset.create(project=project, name='cupcake', kind='prop')
Пример #4
0
def test_cls_name():
    assert Asset.cls_name() == 'Asset'
Пример #5
0
def test_find_library(asset_library):
    assert asset_library in Asset.find(project=asset_library.project,
                                       library=True)
Пример #6
0
def test_findby_name(asset):
    assert asset == Asset.find_one(project=asset.project, name=asset.name)
Пример #7
0
def test_findby_ids(asset):
    assert asset in Asset.findby_ids([asset.id])
Пример #8
0
def test_find(asset):
    assert asset in Asset.find()