changeset 4834:f8cc357576c3

Groups2009: CompositeDicts backend.
author Dmitrijs Milajevs <dimazest@gmail.com>
date Sat, 04 Jul 2009 13:55:55 +0100
parents 50732c861ac2
children cf3c81f67862
files MoinMoin/datastruct/__init__.py MoinMoin/datastruct/backends/_tests/__init__.py MoinMoin/datastruct/backends/_tests/test_wiki_dicts.py
diffstat 3 files changed, 25 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/datastruct/__init__.py	Sat Jul 04 12:13:46 2009 +0100
+++ b/MoinMoin/datastruct/__init__.py	Sat Jul 04 13:55:55 2009 +0100
@@ -8,8 +8,12 @@
 
 from MoinMoin.datastruct.backends.wiki_dicts import WikiDicts
 from MoinMoin.datastruct.backends.config_dicts import ConfigDicts
+from MoinMoin.datastruct.backends.composite_dicts import CompositeDicts
+
 from MoinMoin.datastruct.backends.wiki_groups import WikiGroups
 from MoinMoin.datastruct.backends.config_groups import ConfigGroups
 from MoinMoin.datastruct.backends.composite_groups import CompositeGroups
+
 from MoinMoin.datastruct.backends import GroupDoesNotExistError
+from MoinMoin.datastruct.backends import DictDoesNotExistError
 
--- a/MoinMoin/datastruct/backends/_tests/__init__.py	Sat Jul 04 12:13:46 2009 +0100
+++ b/MoinMoin/datastruct/backends/_tests/__init__.py	Sat Jul 04 13:55:55 2009 +0100
@@ -141,22 +141,27 @@
 class DictsBackendTest(object):
 
     dicts = {u'SomeTestDict': {u'First': u'first item',
-                            u'text with spaces': u'second item',
-                            u'Empty string': u'',
-                            u'Last': u'last item'}}
+                               u'text with spaces': u'second item',
+                               u'Empty string': u'',
+                               u'Last': u'last item'},
+             u'SomeOtherTestDict': {u'One': '1',
+                                    u'Two': '2'}}
 
     def test_getitem(self):
-        expected_dict = self.dicts[u'SomeTestDict']
+        expected_dicts = self.dicts
         dicts = self.request.dicts
-        test_dict = dicts[u'SomeTestDict']
 
-        assert len(test_dict) == len(expected_dict)
-        for key, value in expected_dict.items():
-            assert test_dict[key] == value
+        for dict_name, expected_dict in expected_dicts.items():
+            test_dict = dicts[dict_name]
+            assert len(test_dict) == len(expected_dict)
+            for key, value in expected_dict.items():
+                assert test_dict[key] == value
 
     def test_contains(self):
         dicts = self.request.dicts
 
-        assert u'SomeTestDict' in dicts
+        for key in self.dicts:
+            assert key in dicts
+
         assert u'SomeNotExistingDict' not in dicts
 
--- a/MoinMoin/datastruct/backends/_tests/test_wiki_dicts.py	Sat Jul 04 12:13:46 2009 +0100
+++ b/MoinMoin/datastruct/backends/_tests/test_wiki_dicts.py	Sat Jul 04 13:55:55 2009 +0100
@@ -32,12 +32,18 @@
  Empty string::\x20
  Last:: last item
 '''
+        create_page(request, u'SomeTestDict', text)
 
-        create_page(request, u'SomeTestDict', text)
+        text = """
+ One:: 1
+ Two:: 2
+"""
+        create_page(request, u'SomeOtherTestDict', text)
 
     def teardown_class(self):
         become_trusted(self.request)
         nuke_page(self.request, u'SomeTestDict')
+        nuke_page(self.request, u'SomeOtherTestDict')
 
 
 coverage_modules = ['MoinMoin.datastruct.backends.wiki_dicts']