diff MoinMoin/converter/_tests/test_include.py @ 1451:c32ff2e07e7a

Introduce itemtype. itemtype is used to affect the overall frontend view of an item, and to affect the indexer by offering a set of metadata keys. The original items.Item hierarchy was mosted turned into the new Content hierarchy, leaving code affecting the overview in the new Item and Default (which is an Item descent) classes. Item instances now have a `content` property which is what used to be an Item instance (now a Content instance). This is the first itemtype changeset which just moves codes around ensure they are not broken. More changesets follow soon.
author Cheer Xiao <xiaqqaix@gmail.com>
date Sat, 28 Jul 2012 01:22:44 +0800
parents 4ac437141bbe
children 7f938234a924
line wrap: on
line diff
--- a/MoinMoin/converter/_tests/test_include.py	Thu Jul 26 22:52:17 2012 +0200
+++ b/MoinMoin/converter/_tests/test_include.py	Sat Jul 28 01:22:44 2012 +0800
@@ -9,7 +9,7 @@
 import pytest
 
 from MoinMoin.converter.include import *
-from MoinMoin.items import MoinWiki
+from MoinMoin.items import Item
 from MoinMoin.config import CONTENTTYPE
 from MoinMoin._tests import wikiconfig, update_item
 
@@ -65,20 +65,20 @@
 
     def test_IncludeHandlesCircularRecursion(self):
         # issue #80
-        # we use MoinWiki items to make tests simple
+        # we use text/x.moin.wiki markup to make tests simple
         update_item(u'page1', {CONTENTTYPE: u'text/x.moin.wiki'}, u'{{page2}}')
         update_item(u'page2', {CONTENTTYPE: u'text/x.moin.wiki'}, u'{{page3}}')
         update_item(u'page3', {CONTENTTYPE: u'text/x.moin.wiki'}, u'{{page4}}')
         update_item(u'page4', {CONTENTTYPE: u'text/x.moin.wiki'}, u'{{page2}}')
 
-        page1 = MoinWiki.create(u'page1')
-        rendered = page1._render_data()
+        page1 = Item.create(u'page1')
+        rendered = page1.content._render_data()
         # an error message will follow strong tag
         assert '<strong class="moin-error">' in rendered
 
     def test_ExternalInclude(self):
         update_item(u'page1', {CONTENTTYPE: u'text/x.moin.wiki'}, u'{{http://moinmo.in}}')
-        rendered = MoinWiki.create(u'page1')._render_data()
+        rendered = Item.create(u'page1').content._render_data()
         assert '<object class="moin-http moin-transclusion" data="http://moinmo.in" data-href="http://moinmo.in">http://moinmo.in</object>' in rendered
 
     def test_InlineInclude(self):
@@ -86,32 +86,32 @@
         update_item(u'page1', {CONTENTTYPE: u'text/x.moin.wiki'}, u'Content of page2 is "{{page2}}".')
 
         update_item(u'page2', {CONTENTTYPE: u'text/x.moin.wiki'}, u'Single line')
-        rendered = MoinWiki.create(u'page1')._render_data()
+        rendered = Item.create(u'page1').content._render_data()
         assert '<p>Content of page2 is "<span class="moin-transclusion" data-href="/page2">Single line</span>".</p>' in rendered
 
         update_item(u'page2', {CONTENTTYPE: u'text/x.moin.wiki'}, u'Two\n\nParagraphs')
-        rendered = MoinWiki.create(u'page1')._render_data()
+        rendered = Item.create(u'page1').content._render_data()
         assert '<p>Content of page2 is "</p><div class="moin-transclusion" data-href="/page2"><p>Two</p><p>Paragraphs</p></div><p>".</p></div>' in rendered
 
         update_item(u'page2', {CONTENTTYPE: u'text/x.moin.wiki'}, u"this text contains ''italic'' string")
-        rendered = MoinWiki.create(u'page1')._render_data()
+        rendered = Item.create(u'page1').content._render_data()
         assert 'Content of page2 is "<span class="moin-transclusion" data-href="/page2">this text contains <em>italic</em>' in rendered
 
         update_item(u'page1', {CONTENTTYPE: u'text/x.moin.wiki'}, u'Content of page2 is\n\n{{page2}}')
         update_item(u'page2', {CONTENTTYPE: u'text/x.moin.wiki'}, u"Single Line")
-        rendered = MoinWiki.create(u'page1')._render_data()
+        rendered = Item.create(u'page1').content._render_data()
         assert '<p>Content of page2 is</p><p><span class="moin-transclusion" data-href="/page2">Single Line</span></p>' in rendered
 
         update_item(u'page1', {CONTENTTYPE: u'text/x.moin.wiki'}, u'Content of page2 is "{{page2}}"')
         update_item(u'page2', {CONTENTTYPE: u'text/x.moin.wiki'}, u"|| table || cell ||")
-        rendered = MoinWiki.create(u'page1')._render_data()
+        rendered = Item.create(u'page1').content._render_data()
         assert 'Content of page2 is "</p>' in rendered
         assert '<table>' in rendered
         assert rendered.count('<table>') == 1
 
         update_item(u'page1', {CONTENTTYPE: u'text/x.moin.wiki'}, u'Content of page2 is "{{page2}}"')
         update_item(u'page2', {CONTENTTYPE: u'text/x.moin.wiki'}, u"|| this || has ||\n|| two || rows ||")
-        rendered = MoinWiki.create(u'page1')._render_data()
+        rendered = Item.create(u'page1').content._render_data()
         assert 'Content of page2 is "</p>' in rendered
         assert '<table>' in rendered
         assert rendered.count('<table>') == 1
@@ -121,11 +121,11 @@
         update_item(u'logo', {CONTENTTYPE: u'image/png'}, u'')
 
         update_item(u'page1', {CONTENTTYPE: u'text/x.moin.wiki'}, u'{{logo}}')
-        rendered = MoinWiki.create(u'page1')._render_data()
+        rendered = Item.create(u'page1').content._render_data()
         assert '<img alt="logo" class="moin-transclusion"' in rendered
 
         # <p /> is not valid html5; should be <p></p>. to be valid.  Even better, there should be no empty p's.
         update_item(u'page1', {CONTENTTYPE: u'text/x.moin.wiki'}, u'{{logo}}{{logo}}')
-        rendered = MoinWiki.create(u'page1')._render_data()
+        rendered = Item.create(u'page1').content._render_data()
         assert '<p />' not in rendered
         assert '<p></p>' not in rendered