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"')
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)
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')
def test_cls_name(): assert Asset.cls_name() == 'Asset'
def test_find_library(asset_library): assert asset_library in Asset.find(project=asset_library.project, library=True)
def test_findby_name(asset): assert asset == Asset.find_one(project=asset.project, name=asset.name)
def test_findby_ids(asset): assert asset in Asset.findby_ids([asset.id])
def test_find(asset): assert asset in Asset.find()