Пример #1
0
    def test_get_embed(self):
        """
        get_embed() should return the HTML to embed the given YouTube video.
        """
        embed_code = """<object width="425" height="344">\
<param name="movie"\
 value="http://www.youtube.com/v/oHg5SJYRHA0?f=videos&amp;app=youtube_gdata">\
<param name="allowFullScreen" value="true">\
<param name="allowscriptaccess" value="always">\
<embed\
 src="http://www.youtube.com/v/oHg5SJYRHA0?f=videos&amp;app=youtube_gdata"\
 allowscriptaccess="always" height="344" width="425" allowfullscreen="true"\
 type="application/x-shockwave-flash"></embed></object>"""
        self.assertEquals(youtube.get_embed(BASE_URL), embed_code)
        self.assertEquals(youtube.get_embed(BASE_URL_SHORT), embed_code)
Пример #2
0
    def test_get_embed(self):
        """
        get_embed() should return the HTML to embed the given YouTube video.
        """
        embed_code = """<object width="425" height="344">\
<param name="movie"\
 value="http://www.youtube.com/v/oHg5SJYRHA0&amp;hl=en&amp;fs=1">\
<param name="allowFullScreen" value="true">\
<param name="allowscriptaccess" value="always">\
<embed src="http://www.youtube.com/v/oHg5SJYRHA0&amp;hl=en&amp;fs=1"\
 allowscriptaccess="always" height="344" width="425" allowfullscreen="true"\
 type="application/x-shockwave-flash"></embed></object>"""
        self.assertEquals(youtube.get_embed(BASE_URL), embed_code)
Пример #3
0
    def test_get_embed_not_embedable(self):
        """
        get_embed() should return some HTML even if the video isn't really
        embedable.
        """
        embed_code = """<object width="425" height="344">\
<param name="movie"\
 value="http://www.youtube.com/v/X5rHMVhbWA0&amp;hl=en&amp;fs=1">\
<param name="allowFullScreen" value="true"><param name="allowscriptaccess"\
 value="always"><embed\
 src="http://www.youtube.com/v/X5rHMVhbWA0&amp;hl=en&amp;fs=1"\
 allowscriptaccess="always" height="344" width="425" allowfullscreen="true" \
type="application/x-shockwave-flash"></embed></object>"""
        self.assertEquals(
            youtube.get_embed("http://www.youtube.com/watch?v=X5rHMVhbWA0"),
            embed_code)