예제 #1
0
파일: __init__.py 프로젝트: streamr/marvin
 def authenticate(self):
     with self.app.test_request_context():
         user = User(username='******', password='******', email='*****@*****.**')
         db.session.add(user)
         db.session.commit()
         self.auth_header = {'authorization': 'Token %s' % user.get_auth_token()}
         self.user = user
예제 #2
0
    def setUp(self):
        self.authenticate()
        movie = Movie(
            title='Avatar',
            external_id='imdb:tt0499549',
        )
        stream = Stream(name='CinemaSins', movie=movie, creator=self.user)
        too_big_tv = Entry(
            entry_point_in_ms=3*60*1000,
            stream=stream,
            title='<h1>Title</h1>',
            content_type='text',
            content={"text": "<p>Do you really need a wall-sized TV when you're sitting 3 inches from it?</p>"},
        )
        cardboard_coffin = Entry(
            entry_point_in_ms=5*60*1000,
            stream=stream,
            title='<h1>Title</h1>',
            content_type='text',
            content={
                "text": "<p>Why are the coffins of the future made out of cardboard?</p>"
            },
        )
        self.stream_id, self.tv_id, self.cardboard_id, self.movie_id = self.addItems(
            stream, too_big_tv, cardboard_coffin, movie)

        with self.app.test_request_context():
            alice = User(username='******', email='*****@*****.**', password='******')
            alices_stream = Stream(name='Alices stream', movie_id=self.movie_id, creator=alice)
            _, self.alices_stream_id = self.addItems(alice, alices_stream) # pylint: disable=unbalanced-tuple-unpacking
            self.alices_auth_header = {'authorization': 'Token %s' % alice.get_auth_token()}