def test_create_unique_proj_seq_name(shot): # Expecting IntegrityError error "Duplicate entry..." try: Shot.create(name=shot.name, project=shot.sequence.project, sequence=shot.sequence) except IntegrityError: return raise AssertionError('Expected IntegrityError due to "Duplicate entry"')
def shot_episode(sequence_episode): try: return Shot.find_one(sequence=sequence_episode, name='001') except NoResultFound: return Shot.create(project=sequence_episode.project, sequence=sequence_episode, name='001', cut=(1001, 1002))