def test_provide_api_invalid_url(self): """ If an unknown URL is accessed, the provide_api decorator should raise BaseUrlLoadFailure. """ func = youtube.provide_api(lambda x, shortmem: True) self.assertRaises(errors.BaseUrlLoadFailure, func, 'http://www.youtube.com/watch?v=Vbvf1Q3DrPY', {})
def test_provide_api_invalid_url(self): """ If an unknown URL is accessed, the provide_api decorator should raise BaseUrlLoadFailure. """ func = youtube.provide_api(lambda x, shortmem: True) self.assertRaises( errors.BaseUrlLoadFailure, func, 'http://www.youtube.com/watch?v=Vbvf1Q3DrPY', {})
def test_provide_api_private_url(self): """ If an private URL is accessed, the provide_api decorator should raise VideoDeleted. """ func = youtube.provide_api(lambda x, shortmem: True) self.assertRaises( errors.VideoDeleted, func, 'http://www.youtube.com/watch?v=Vbvf1Q3DrPY', {})
def test_provide_api_deleted_video(self): """ If a deleted URL is accessed, the provide_api decorator should raise VideoDeleted. """ func = youtube.provide_api(lambda x, shortmem: True) self.assertRaises( errors.VideoDeleted, func, 'http://www.youtube.com/watch?v=vLdfSn2xr-Q', {})
def test_provide_api_short_url(self): """ If a short URL is given (http://youtu.be/foo), provide API should still parse the feed. """ def _(url, shortmem): self.assertTrue('base_etree' in shortmem) return True self.assertTrue(youtube.provide_api(_)( 'http://youtu.be/oHg5SJYRHA0', {}))