def test_create_unique_seq_name(instance_sequence): # Expecting IntegrityError error "Duplicate entry..." try: Instance.create(project=instance_sequence.project, name=instance_sequence.name, asset=instance_sequence.asset, entity=instance_sequence.parent) except IntegrityError: return raise AssertionError('Expected IntegrityError due to "Duplicate entry"')
def test_create_bad_arguments_asset(instance_shot): # Expecting TypeError error, wrong argument/entity given. try: Instance.create(project=instance_shot.project, name=instance_shot.name, asset=instance_shot.asset, entity=instance_shot.asset) except TypeError: return raise AssertionError('Expected TypeError due to wrong arg type')
def instance_shot(shot, asset): try: return Instance.find_one(project=shot.project, entity=shot, asset=asset, name='instance01') except NoResultFound: return Instance.create(project=shot.project, entity=shot, asset=asset, name='instance01')