test that passing unicode to a youtube id does not throw an error (TNL-5127)

This commit is contained in:
Adam Palay
2016-07-29 14:07:08 -04:00
parent 66d4dc9397
commit ec1cbdf513
2 changed files with 13 additions and 2 deletions

View File

@@ -233,6 +233,17 @@ class TestCreateYoutubeString(VideoDescriptorTestBase):
expected = "0.75:izygArpw-Qo,1.00:p2Q6BrNhdh8,1.25:1EeWXzPdhSA"
self.assertEqual(create_youtube_string(self.descriptor), expected)
class TestCreateYouTubeUrl(VideoDescriptorTestBase):
"""
Tests for helper method `create_youtube_url`.
"""
def test_create_youtube_url_unicode(self):
"""
Test that passing unicode to `create_youtube_url` doesn't throw
an error.
"""
self.descriptor.create_youtube_url(u"üñîçø∂é")
@ddt.ddt
class VideoDescriptorImportTestCase(unittest.TestCase):

View File

@@ -619,9 +619,9 @@ class VideoDescriptor(VideoFields, VideoTranscriptsMixin, VideoStudioViewHandler
A full youtube url to the video whose ID is passed in
"""
if youtube_id:
return 'https://www.youtube.com/watch?v={0}'.format(youtube_id)
return u'https://www.youtube.com/watch?v={0}'.format(youtube_id)
else:
return ''
return u''
def get_context(self):
"""