Esempio n. 1
0
    def setUp(self):
        """Create test client, add sample data."""
        
        db.drop_all()
        db.create_all()
        
        Steve1 = User.signup(username="******", password="******", first_name="steven", last_name="damouni", email="*****@*****.**")
        Steveid1 = 1111
        Steve1.id = Steveid1

        genre1 = Genre(genre="classical")
        genre1id = 1111
        genre1.id = genre1id

        region1 = Region(city="Seattle", county="King", state="Washington")
        region1id = 1111
        region1.id = region1id

        instrument1 = Instrument(instrument="piano")
        instrument1id = 1111
        instrument1.id = instrument1id

        db.session.add(genre1)
        db.session.add(region1)
        db.session.add(instrument1)
        db.session.commit()

        Steve1 = User.query.get(Steveid1)
        genre1 = Genre.query.get(genre1id)
        region1 = Region.query.get(region1id)
        instrument1 = Instrument.query.get(instrument1id)

        self.Steve1 = Steve1
        self.Steveid1 = Steveid1

        self.genre1 = genre1
        self.genre1id = genre1id

        self.region1 = region1
        self.region1id = region1id

        self.instrument1 = instrument1
        self.instrument1id = instrument1id

        self.client = app.test_client()
 def create_region(self, a):
     da = Region()
     da.video_id = self.video.pk
     da.x = a['x']
     da.y = a['y']
     da.h = a['h']
     da.w = a['w']
     da.text = a['text']
     da.metadata = a['metadata']
     da.png = a.get('png', False)
     da.per_event_index = a['per_event_index']
     da.region_type = a['region_type']
     da.confidence = a['confidence']
     da.object_name = a['object_name']
     da.full_frame = a['full_frame']
     da.event_id = self.event_to_pk[a['event']]
     da.id = '{}_{}'.format(da.event_id,da.per_event_index)
     da.frame_index = a['frame_index']
     da.segment_index = a.get('segment_index', -1)
     return da