Пример #1
0
 def test_info(self):
     show_id = 32
     responses.add(responses.GET, Tvmaze._url.format(show_id=show_id),
               body=self.show, status=200, content_type='application/json')
     tvmaze = Tvmaze()
     show = tvmaze.info(show_id)
     schemas.validate(schemas.Show_schema, show)
     self.assertTrue('premiered' in show)
Пример #2
0
 def test_episodes(self):
     show_id = 32
     responses.add(responses.GET, Tvmaze._url_episodes.format(show_id=show_id),
               body=self.episodes, status=200, content_type='application/json')
     tvmaze = Tvmaze()
     episodes = tvmaze.episodes(show_id)
     schemas.validate([schemas.Episode_schema], episodes)
     self.assertEqual(episodes[0]['air_date'], datetime(2014, 4, 16).date())
     self.assertEqual(episodes[0]['air_time'], datetime(2014, 4, 16, 2).time())
Пример #3
0
 def test_info(self):
     show_id = 32
     responses.add(responses.POST, Thetvdb._url+'/login',
               body=self.login, status=200, content_type='application/json')        
     responses.add(responses.GET, Thetvdb._url+'/series/{}'.format(show_id),
               body=self.show, status=200, content_type='application/json')
     thetvdb = Thetvdb()
     show = thetvdb.info(show_id)
     schemas.validate(schemas.Show_schema, show)
     self.assertEqual(show['premiered'].isoformat(), '2017-04-05')
     self.assertEqual(show['title'], 'Boruto: Naruto Next Generations')
Пример #4
0
    def test_episodes(self):
        show_id = 32
        responses.add(responses.POST, Thetvdb._url+'/login',
                  body=self.login, status=200, content_type='application/json')
        responses.add(responses.GET, Thetvdb._url+'/series/{}/episodes'.format(show_id),
                  body=self.episodes, status=200, content_type='application/json')
        thetvdb = Thetvdb()
        episodes = thetvdb.episodes(show_id)

        schemas.validate([schemas.Episode_schema], episodes)
        self.assertEqual(episodes[0]['air_date'].isoformat(), '2003-09-23')
Пример #5
0
 def test_images(self):
     thetvdb = Thetvdb('apikey')
     images = thetvdb.get_images(123)
     self.assertEqual(len(images), 2)
     self.assertEqual(images[0]['source_url'],
                      'http://thetvdb.com/banners/posters/80348-16.jpg')
     self.assertEqual(images[0]['source_title'], 'TheTVDB')
     self.assertEqual(images[0]['external_name'], 'thetvdb')
     self.assertEqual(images[0]['external_id'], '877696')
     self.assertEqual(images[0]['type'], constants.IMAGE_TYPE_POSTER)
     schemas.validate(schemas.Image, images[0])
Пример #6
0
 def test_info(self):
     show_id = 32
     responses.add(responses.GET,
                   Tvmaze._url.format(show_id=show_id),
                   body=self.show,
                   status=200,
                   content_type='application/json')
     tvmaze = Tvmaze()
     show = tvmaze.info(show_id)
     schemas.validate(schemas.Show_schema, show)
     self.assertTrue('premiered' in show)
Пример #7
0
 def test_images(self):
     show_id = 32
     responses.add(responses.GET, Tvmaze._url.format(show_id=show_id),
               body=self.show, status=200, content_type='application/json')
     tvmaze = Tvmaze()
     images = tvmaze.images(show_id)
     image = images[0]
     schemas.validate(schemas.Image_required, image)
     self.assertEqual('TVmaze', image['source_title'])
     self.assertEqual('tvmaze', image['external_name'])
     self.assertEqual('32', image['external_id'])
     self.assertEqual(constants.IMAGE_TYPE_POSTER, image['type'])
Пример #8
0
 def test_images(self):
     thetvdb = Thetvdb('apikey')
     images = thetvdb.get_images(123)
     self.assertEqual(len(images), 2)
     self.assertEqual(
         images[0]['source_url'], 
         'http://thetvdb.com/banners/posters/80348-16.jpg'
     )
     self.assertEqual(images[0]['source_title'], 'TheTVDB')
     self.assertEqual(images[0]['external_name'], 'thetvdb')
     self.assertEqual(images[0]['external_id'], '877696')
     self.assertEqual(images[0]['type'], constants.IMAGE_TYPE_POSTER)
     schemas.validate(schemas.Image, images[0])
Пример #9
0
 def test_episodes(self):
     show_id = 32
     responses.add(responses.GET,
                   Tvmaze._url_episodes.format(show_id=show_id),
                   body=self.episodes,
                   status=200,
                   content_type='application/json')
     tvmaze = Tvmaze()
     episodes = tvmaze.episodes(show_id)
     schemas.validate([schemas.Episode_schema], episodes)
     self.assertEqual(episodes[0]['air_date'], datetime(2014, 4, 15).date())
     self.assertEqual(episodes[0]['air_time'],
                      datetime(2014, 4, 15, 22).time())
Пример #10
0
 def test(self):
     thetvdb = Thetvdb('apikey')
     ids = [72108, 123]
     for id_ in ids:
         show = thetvdb.get_show(id_)
         show['episodes'] = thetvdb.get_episodes(id_)
         schemas.validate(schemas.Show_schema, show)
         if id_ == 72108:
             self.assertEqual(show['genres'], [
                 'Action',
                 'Adventure',
                 'Drama',
             ])
             self.assertEqual(show['externals']['imdb'], 'tt0364845')
Пример #11
0
 def test_images(self):
     show_id = 32
     responses.add(responses.POST, Thetvdb._url+'/login',
               body=self.login, status=200, content_type='application/json')
     responses.add(responses.GET, Thetvdb._url+'/series/{}/images/query'.format(show_id),
               body=self.images, status=200, content_type='application/json')
     thetvdb = Thetvdb()
     images = thetvdb.images(show_id)
     image = images[0]
     schemas.validate(schemas.Image_required, image)
     self.assertEqual('TheTVDB', image['source_title'])
     self.assertEqual('thetvdb', image['external_name'])
     self.assertEqual('1174797', image['external_id'])
     self.assertEqual(constants.IMAGE_TYPE_POSTER, image['type'])
Пример #12
0
 def test(self):
     thetvdb = Thetvdb('apikey')
     ids = [72108, 123]
     for id_ in ids:
         show = thetvdb.get_show(id_)
         show['episodes'] = thetvdb.get_episodes(id_)
         schemas.validate(schemas.Show_schema, show)
         if id_ == 72108:
             self.assertEqual(show['genres'], [
                 'Action',
                 'Adventure',
                 'Drama',
             ])
             self.assertEqual(show['externals']['imdb'], 'tt0364845')
Пример #13
0
 def test_images(self):
     show_id = 32
     responses.add(responses.GET,
                   Tvmaze._url.format(show_id=show_id),
                   body=self.show,
                   status=200,
                   content_type='application/json')
     tvmaze = Tvmaze()
     images = tvmaze.images(show_id)
     image = images[0]
     schemas.validate(schemas.Image_required, image)
     self.assertEqual('TVmaze', image['source_title'])
     self.assertEqual('tvmaze', image['external_name'])
     self.assertEqual('32', image['external_id'])
     self.assertEqual(constants.IMAGE_TYPE_POSTER, image['type'])
Пример #14
0
 def test(self):
     tvrage = Tvrage()
     tvrage_ids = [4628, 2445, 5613, 20370, 3140, 5294, 25923]
     for id_ in tvrage_ids:
         print(id_)
         show = tvrage.get_show(id_)
         show['episodes'] = tvrage.get_episodes(id_)
         schemas.validate(schemas.Show_schema, show)
         self.assertTrue(show['episodes'])
         if id_ == 4628:
             self.assertEqual(show['genres'], [
                 'Action',
                 'Crime',
                 'Drama',
                 'Military/War',
             ])