def test_url_stripping_main(): eq( yturl.video_id_from_url( "http://www.youtube.com/watch?feature=player_embed&v=gEl6TXrkZnk" ), "gEl6TXrkZnk", )
def test_video_id_from_url_unparseable(url): with assert_raises(yturl.VideoIDParserError): yturl.video_id_from_url(url)
def test_video_id_from_url(url, expected): eq(yturl.video_id_from_url(url), expected)
def test_url_stripping_short(): eq( yturl.video_id_from_url("youtu.be/gEl6TXrkZnk#foo"), "gEl6TXrkZnk", )
def save_model(self, request, instance, form, change): instance.youtube_code = video_id_from_url( form.cleaned_data['youtube_code']) instance.save() form.save_m2m() return instance
def test_url_stripping(): eq_(yturl.video_id_from_url("http://www.youtube.com/watch?feature=player_embedded&v=gEl6TXrkZnk"), "gEl6TXrkZnk") eq_(yturl.video_id_from_url("youtu.be/gEl6TXrkZnk#foo"), "gEl6TXrkZnk")
def test_video_id_parsed_from_url(video_id, url_format): ''' That that video IDs are successfully parsed from URLs. ''' url = url_format % video_id eq(yturl.video_id_from_url(url), video_id)
def test_url_stripping_main(): eq( yturl.video_id_from_url( "http://www.youtube.com/watch?feature=player_embed&v=gEl6TXrkZnk"), "gEl6TXrkZnk", )