comparison MoinMoin/groups/_tests/test_backend_manager.py @ 4775:0a0387a9eb1e

Groups2009: BackendManager does not require request object in __init__
author Dmitrijs Milajevs <dimazest@gmail.com>
date Sun, 31 May 2009 21:17:49 +0200
parents c3e904a9c00b
children 1b84b35fbe91
comparison
equal deleted inserted replaced
4774:fb0cce9e8621 4775:0a0387a9eb1e
24 24
25 groups = {u'AdminGroup': self.admin_group, 25 groups = {u'AdminGroup': self.admin_group,
26 u'EditorGroup': self.editor_group, 26 u'EditorGroup': self.editor_group,
27 u'FruitGroup': self.fruit_group} 27 u'FruitGroup': self.fruit_group}
28 28
29 self.group_backend = BackendManager(request=self.request, 29 self.group_backend = BackendManager(backend=groups)
30 backend=groups)
31 30
32 def test_getitem(self): 31 def test_getitem(self):
33 """ 32 """
34 Test of the __getitem__ API method. It should return a group 33 Test of the __getitem__ API method. It should return a group
35 object by the group name. 34 object by the group name.
90 # Simply drop last five letters, what is length of word "Group" 89 # Simply drop last five letters, what is length of word "Group"
91 mapper_to_backend = lambda group_name: group_name[:-5] 90 mapper_to_backend = lambda group_name: group_name[:-5]
92 # Add "Group" postfix for every group name received from a backend 91 # Add "Group" postfix for every group name received from a backend
93 mapper_from_backend = lambda group_name: "%sGroup" % group_name 92 mapper_from_backend = lambda group_name: "%sGroup" % group_name
94 93
95 self.group_backend = BackendManager(request=self.request, 94 self.group_backend = BackendManager(backend=groups,
96 backend=groups,
97 mapper_to_backend=mapper_to_backend, 95 mapper_to_backend=mapper_to_backend,
98 mapper_from_backend=mapper_from_backend) 96 mapper_from_backend=mapper_from_backend)
99 97
100 def test_getitem(self): 98 def test_getitem(self):
101 admin_group = self.group_backend[u'AdminGroup'] 99 admin_group = self.group_backend[u'AdminGroup']