def test_complicated_shortcode(self): text = '<p style="text-align: center;">[youtube VNmliVqLKeg 560 340]</p>' out = parse_shortcodes.parse(text) self.assertEquals( out, '<p style="text-align: center;"><iframe width="560" height="315" src="http://www.youtube.com/embed/VNmliVqLKeg?feature=oembed" frameborder="0" allowfullscreen></iframe></p>' )
def test_caption_shortcode_with_unicode(self): text = 'blah \u2603 blah [caption id="attachment_68" align="alignnone" width="900" caption="Caption goes here! \u2603"]<img />[/caption]' out = parse_shortcodes.parse(text) self.assertEquals( out, 'blah \u2603 blah <div id="attachment_68" class=\'wp-caption\' align="alignnone" style="width: \'910px\'"><img /><p class=\'wp-caption-text\'>Caption goes here! \u2603</p></div>' )
def test_invalid_shortcode(self): text = "blah blah [somethingelse monkeypoo]" out = parse_shortcodes.parse(text) self.assertEquals(out, 'blah blah [somethingelse monkeypoo]')
def test_invalid_youtube_shortcode(self): text = "blah blah [youtube monkeypoo]" out = parse_shortcodes.parse(text) self.assertEquals(text, 'blah blah [youtube monkeypoo]')
def test_really_empty_youtube_shortcode(self): text = "blah blah [youtube]" out = parse_shortcodes.parse(text) self.assertEquals(text, 'blah blah [youtube]')
def test_complicated_shortcode(self): text = '<p style="text-align: center;">[youtube VNmliVqLKeg 560 340]</p>' out = parse_shortcodes.parse(text) self.assertEquals(out,'<p style="text-align: center;"><iframe width="560" height="315" src="http://www.youtube.com/embed/VNmliVqLKeg?feature=oembed" frameborder="0" allowfullscreen></iframe></p>')
def test_simple_shortcode(self): text = "asdihasdf fioasdi [youtube oHg5SJYRHA0]" out = parse_shortcodes.parse(text) assert ( '<iframe width="800" height="600" src="http://www.youtube.com/embed/oHg5SJYRHA0?feature=oembed" frameborder="0" allowfullscreen></iframe>' in out)
def test_invalid_shortcode(self): text = "blah blah [somethingelse monkeypoo]" out = parse_shortcodes.parse(text) self.assertEquals(out,'blah blah [somethingelse monkeypoo]')
def test_caption_shortcode_with_unicode(self): text = 'blah \u2603 blah [caption id="attachment_68" align="alignnone" width="900" caption="Caption goes here! \u2603"]<img />[/caption]' out = parse_shortcodes.parse(text) self.assertEquals(out,'blah \u2603 blah <div id="attachment_68" class=\'wp-caption\' align="alignnone" style="width: \'910px\'"><img /><p class=\'wp-caption-text\'>Caption goes here! \u2603</p></div>')
def test_really_empty_youtube_shortcode(self): text = "blah blah [youtube]" out = parse_shortcodes.parse(text) self.assertEquals(text,'blah blah [youtube]')
def test_invalid_youtube_shortcode(self): text = "blah blah [youtube monkeypoo]" out = parse_shortcodes.parse(text) self.assertEquals(text,'blah blah [youtube monkeypoo]')
def test_simple_shortcode(self): text = "asdihasdf fioasdi [youtube oHg5SJYRHA0]" out = parse_shortcodes.parse(text) assert('<iframe width="800" height="600" src="http://www.youtube.com/embed/oHg5SJYRHA0?feature=oembed" frameborder="0" allowfullscreen></iframe>' in out)