Example #1
0
 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>'
     )
Example #2
0
 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>'
     )
Example #3
0
 def test_invalid_shortcode(self):
     text = "blah blah [somethingelse monkeypoo]"
     out = parse_shortcodes.parse(text)
     self.assertEquals(out, 'blah blah [somethingelse monkeypoo]')
Example #4
0
 def test_invalid_youtube_shortcode(self):
     text = "blah blah [youtube monkeypoo]"
     out = parse_shortcodes.parse(text)
     self.assertEquals(text, 'blah blah [youtube monkeypoo]')
Example #5
0
 def test_really_empty_youtube_shortcode(self):
     text = "blah blah [youtube]"
     out = parse_shortcodes.parse(text)
     self.assertEquals(text, 'blah blah [youtube]')
Example #6
0
 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>')
Example #7
0
 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)
Example #8
0
 def test_invalid_shortcode(self):
     text = "blah blah [somethingelse monkeypoo]"
     out = parse_shortcodes.parse(text)
     self.assertEquals(out,'blah blah [somethingelse monkeypoo]')
Example #9
0
 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>')
Example #10
0
 def test_really_empty_youtube_shortcode(self):
     text = "blah blah [youtube]"
     out = parse_shortcodes.parse(text)
     self.assertEquals(text,'blah blah [youtube]')
Example #11
0
 def test_invalid_youtube_shortcode(self):
     text = "blah blah [youtube monkeypoo]"
     out = parse_shortcodes.parse(text)
     self.assertEquals(text,'blah blah [youtube monkeypoo]')
Example #12
0
 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)