Example #1
0
    def test_get_podcast_cover(self):
        p = Podcast(author=self.user, title='test', description='lorem ipsum')
        p.audio_file = 'test.mp3'
        db.session.add(p)
        db.session.commit()

        with self.client:
            res = self.client.get('/api/podcasts/image/' + p.cover_img)
            self.assertEqual(res.status_code, 200)
            self.assertTrue('image' in res.content_type)
Example #2
0
    def setUp(self):
        super(TestPodcastsPackage, self).setUp()

        for i in range(6):
            p = Podcast(author=self.user,
                        title='preview_test{}'.format(i),
                        description='lorem ipsum')
            p.audio_file = 'test.mp3'
            db.session.add(p)
        for i in range(6):
            p = User(email='testdas{}@mail.com'.format(i),
                     password='******',
                     username='******'.format(i))
            db.session.add(p)
        db.session.commit()

        self.real_podcasts = get_real_podcasts()
Example #3
0
    def setUp(self):
        super(TestPodcastsPackage, self).setUp()

        email = faker.email()
        password = '******'
        username = faker.first_name()

        user = User(email=email, password=password, username=username)
        db.session.add(user)
        db.session.commit()

        for _ in range(30):
            p = Podcast(author=self.user, title=faker.text(20), description='lorem ipsum')
            p.audio_file = 'test.mp3'
            db.session.add(p)

        p = Podcast(author=user, title=faker.text(20), description='lorem ipsum',
                    audio_file=faker.file_name(extension='mp3'))
        db.session.add(p)
        db.session.commit()
        self.user = user
        self.podcast = p

        self.real_podcasts = get_real_podcasts()