changeset 1044:3f5c8ee25691 namespaces

new test for index on multiple named pages
author Luis Henrique Fagundes <lhfagundes@gmail.com>
date Mon, 31 Oct 2011 14:04:06 -0200
parents c8b219b474d0
children 900263d0e393
files MoinMoin/items/_tests/test_Item.py
diffstat 1 files changed, 38 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/items/_tests/test_Item.py	Mon Oct 31 05:43:47 2011 -0200
+++ b/MoinMoin/items/_tests/test_Item.py	Mon Oct 31 14:04:06 2011 -0200
@@ -150,6 +150,43 @@
                               (u'Bar/ij', u'ij', u'application/x-nonexistent'),
                              ]
 
+    def test_index_on_pages_with_multiple_names(self):
+        update_item(u'FooBar', 
+                    {NAME: [u'FooBar', 
+                            u'BarFoo',
+                            ], 
+                     CONTENTTYPE: u'text/x.moin.wiki'}, u'')
+
+        update_item(u'One',
+                    {NAME: [u'One',
+                            u'FooBar/FBChild',
+                            ], 
+                     CONTENTTYPE: u'text/x.moin.wiki'}, u'')
+        update_item(u'Two',
+                    {NAME: [u'BarFoo/BFChild', 
+                            u'Two',
+                            ], 
+                     CONTENTTYPE: u'text/x.moin.wiki'}, u'')
+
+        update_item(u'FooBar/FBChild/Grand', { CONTENTTYPE: u'text/x.moin.wiki'}, u'')
+        update_item(u'Two/TwoChild', { CONTENTTYPE: u'text/x.moin.wiki'}, u'')
+        update_item(u'One/OneChild', { CONTENTTYPE: u'text/x.moin.wiki'}, u'')
+
+        index = Item.create(u'FooBar').get_index()
+        assert index == [(u'FooBar/FBChild', u'FBChild', u'text/x.moin.wiki'),
+                         (u'FooBar/FBChild/Grand', u'FBChild/Grand', u'text/x.moin.wiki'),
+                         ]
+        index = Item.create(u'BarFoo').get_index()
+        assert index == [(u'BarFoo/BFChild', u'BFChild', u'text/x.moin.wiki')]
+
+        assert Item.create(u'BarFoo/BFChild').get_index() == []
+
+        index = Item.create(u'One').get_index()
+        assert index == [(u'One/OneChild', u'OneChild', u'text/x.moin.wiki')]
+
+        index = Item.create(u'Two').get_index()
+        assert index == [(u'Two/TwoChild', u'TwoChild', u'text/x.moin.wiki')]
+
     def test_meta_filter(self):
         name = u'Test_item'
         contenttype = u'text/plain;charset=utf-8'
@@ -312,6 +349,7 @@
         update_item(u'Another/Child', {CONTENTTYPE: u'text/x.moin.wiki'}, u'Child of Another')
 
         item = Item.create(u'Page')
+
         item.rename(u'Renamed', comment=u'renamed')
 
         assert Item.create(u'Page/Child').meta[CONTENTTYPE] == 'application/x-nonexistent'