Esempio n. 1
0
 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)