Add additional test case for `TranscriptsDisabled`

This commit is contained in:
Joshua Lochner 2021-11-29 18:40:01 +02:00
parent bd8d8919b2
commit b8dbc97549
2 changed files with 99 additions and 0 deletions

File diff suppressed because one or more lines are too long

View File

@ -205,6 +205,14 @@ class TestYouTubeTranscriptApi(TestCase):
with self.assertRaises(TranscriptsDisabled): with self.assertRaises(TranscriptsDisabled):
YouTubeTranscriptApi.get_transcript('dsMFmonKDD4') YouTubeTranscriptApi.get_transcript('dsMFmonKDD4')
httpretty.register_uri(
httpretty.GET,
'https://www.youtube.com/watch',
body=load_asset('youtube_transcripts_disabled2.html.static')
)
with self.assertRaises(TranscriptsDisabled):
YouTubeTranscriptApi.get_transcript('Fjg5lYqvzUs')
def test_get_transcript__exception_if_language_unavailable(self): def test_get_transcript__exception_if_language_unavailable(self):
with self.assertRaises(NoTranscriptFound): with self.assertRaises(NoTranscriptFound):
YouTubeTranscriptApi.get_transcript('GJLlxj_dtq8', languages=['cz']) YouTubeTranscriptApi.get_transcript('GJLlxj_dtq8', languages=['cz'])