Ejemplo n.º 1
0
 def test_youtube_error_is_400(self):
     google_key = '123'
     broadcast = 'foo'
     manager = YoutubeManager(logging, None, google_key)
     url = urls.youtube_channel_get(broadcast, google_key)
     code = 400
     httpretty.register_uri(httpretty.GET, url, body=json.dumps(youtube_archive1.DATA), status=code)
     with self.assertRaises(HathorException) as error:
         manager.broadcast_update(broadcast)
     self.check_error_message('Invalid status code:%s' % code, error)
Ejemplo n.º 2
0
 def test_youtube_do_not_download_non_videos(self):
     broadcast = utils.random_string()
     google_key = utils.random_string()
     manager = YoutubeManager(logging, None, google_key)
     url = urls.youtube_channel_get(broadcast,
                                    google_key)
     httpretty.register_uri(httpretty.GET, url, body=json.dumps(youtube_one_item_not_video.DATA),
                            content_type='application/json')
     with mock.patch('youtube_dl.YoutubeDL', side_effect=test_utils.youtube_mock):
         episodes = manager.broadcast_update(broadcast)
         self.assert_length(episodes, 0)