def test_duration_attribute_is_updated_correctly(self): """testing if the duration attribute is updated correctly with the changing values of start_frame and end_frame values """ self.kwargs['number'] = '1duration' new_shot = Shot(**self.kwargs) self.assertEqual(new_shot.start_frame, 1) self.assertEqual(new_shot.end_frame, 100) new_shot.start_frame = 10 self.assertEqual(new_shot.duration, 91) new_shot.end_frame = 110 self.assertEqual(new_shot.duration, 101)
def test_shot_is_CRUD_properly_in_the_database(self): """testing if the shot instance is created properly in the database """ new_proj = Project("TEST_PROJ_FOR_CRUD") new_proj.create() new_seq = Sequence(new_proj, "TEST_SEQ103") new_seq.save() new_shot = Shot(new_seq, '1a') new_shot.save() # now query the database if it is created and read correctly self.assertEqual( new_shot, Shot.query() .filter(Shot.number==new_shot.number) .first() ) # now update it new_shot.start_frame = 100 new_shot.end_frame = 200 new_shot.save() self.assertEqual( new_shot.start_frame, Shot.query() .filter(Shot.number==new_shot.number) .first() .start_frame ) self.assertEqual( new_shot.end_frame, Shot.query() .filter(Shot.number==new_shot.number) .first() .end_frame ) # now delete it db.session.delete(new_shot) db.session.commit() self.assertEqual(len(Shot.query().all()), 1)