Mercurial > moin > 1.9
annotate MoinMoin/groups/backends/_tests/__init__.py @ 4803:167db6117bb4
Groups2009: pep8 fixes and typo elimination. BaseGroup._iter optimization. Test of group names mapping was removed.
author  Dmitrijs Milajevs <dimazest@gmail.com> 

date  Thu, 11 Jun 2009 13:48:54 +0200 
parents  3b05bf18c0d1 
children  ca8fcf330aa8 
rev  line source 

4800
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

1 # * coding: iso88591 * 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

2 """ 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

3 MoinMoin  MoinMoin.groups.backends base test classes. 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

4 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

5 @copyright: 20032004 by Juergen Hermann <jh@web.de>, 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

6 2007 by MoinMoin:ThomasWaldmann 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

7 2008 by MoinMoin:MelitaMihaljevic 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

8 2009 by MoinMoin:DmitrijsMilajevs 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

9 @license: GNU GPL, see COPYING for details. 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

10 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

11 """ 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

12 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

13 from py.test import raises 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

14 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

15 from MoinMoin import security 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

16 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

17 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

18 class BackendTest(object): 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

19 
4803
167db6117bb4
Groups2009: pep8 fixes and typo elimination. BaseGroup._iter optimization. Test of group names mapping was removed.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
4800
diff
changeset

20 test_groups = {u'EditorGroup': [u'AdminGroup', u'John', u'JoeDoe', u'Editor1', u'John'], 
4800
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

21 u'AdminGroup': [u'Admin1', u'Admin2', u'John'], 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

22 u'OtherGroup': [u'SomethingOther'], 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

23 u'RecursiveGroup': [u'Something', u'OtherRecursiveGroup'], 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

24 u'OtherRecursiveGroup': [u'RecursiveGroup', u'Anything'], 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

25 u'ThirdRecursiveGroup': [u'ThirdRecursiveGroup', u'Banana']} 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

26 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

27 expanded_groups = {u'EditorGroup': [u'Admin1', u'Admin2', u'John', 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

28 u'JoeDoe', u'Editor1'], 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

29 u'AdminGroup': [u'Admin1', u'Admin2', u'John'], 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

30 u'OtherGroup': [u'SomethingOther'], 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

31 u'RecursiveGroup': [u'Anything', u'Something'], 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

32 u'OtherRecursiveGroup': [u'Anything', u'Something'], 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

33 u'ThirdRecursiveGroup': [u'Banana']} 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

34 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

35 def test_contains(self): 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

36 """ 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

37 Test group_wiki Backend and Group containment methods. 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

38 """ 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

39 groups = self.request.groups 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

40 
4803
167db6117bb4
Groups2009: pep8 fixes and typo elimination. BaseGroup._iter optimization. Test of group names mapping was removed.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
4800
diff
changeset

41 for group, members in self.expanded_groups.iteritems(): 
4800
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

42 print group 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

43 assert group in groups 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

44 for member in members: 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

45 assert member in groups[group] 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

46 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

47 raises(KeyError, lambda: groups[u'NotExistingGroup']) 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

48 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

49 def test_iter(self): 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

50 groups = self.request.groups 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

51 
4803
167db6117bb4
Groups2009: pep8 fixes and typo elimination. BaseGroup._iter optimization. Test of group names mapping was removed.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
4800
diff
changeset

52 for group, members in self.expanded_groups.iteritems(): 
4800
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

53 returned_members = [x for x in groups[group]] 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

54 assert len(returned_members) == len(members) 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

55 for member in members: 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

56 assert member in returned_members 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

57 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

58 def test_membergroups(self): 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

59 groups = self.request.groups 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

60 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

61 john_groups = groups.membergroups(u'John') 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

62 assert 2 == len(john_groups) 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

63 assert u'EditorGroup' in john_groups 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

64 assert u'AdminGroup' in john_groups 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

65 assert u'ThirdGroup' not in john_groups 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

66 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

67 def test_backend_acl_allow(self): 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

68 """ 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

69 Test if the wiki group backend works with acl code. 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

70 Check user which has rights. 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

71 """ 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

72 request = self.request 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

73 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

74 acl_rights = ["AdminGroup:admin,read,write"] 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

75 acl = security.AccessControlList(request.cfg, acl_rights) 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

76 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

77 allow = acl.may(request, u"Admin1", "admin") 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

78 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

79 assert allow, 'Admin has read rights because he is member of AdminGroup' 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

80 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

81 def test_backend_acl_deny(self): 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

82 """ 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

83 Test if the wiki group backend works with acl code. 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

84 Check user which does not have rights. 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

85 """ 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

86 request = self.request 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

87 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

88 acl_rights = ["AdminGroup:read,write"] 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

89 acl = security.AccessControlList(request.cfg, acl_rights) 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

90 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

91 other_user_allow = acl.may(request, u"OtherUser", "admin") 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

92 some_user_allow = acl.may(request, u"SomeUser", "read") 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

93 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

94 assert not other_user_allow, 'OtherUser does not have admin rights because it is not listed in acl' 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

95 assert not some_user_allow, 'SomeUser does not have admin read right because he is not listed in the AdminGroup' 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

96 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

97 def test_wiki_backend_page_acl_with_all(self): 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

98 request = self.request 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

99 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

100 acl_rights = ["EditorGroup:read,write,delete,admin All:read"] 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

101 acl = security.AccessControlList(request.cfg, acl_rights) 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

102 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

103 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

104 for member in self.expanded_groups[u'EditorGroup']: 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

105 assert acl.may(request, member, "read") 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

106 assert acl.may(request, member, "write") 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

107 assert acl.may(request, member, "delete") 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

108 assert acl.may(request, member, "admin") 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

109 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

110 assert acl.may(request, u"Someone", "read") 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

111 assert not acl.may(request, u"Someone", "write") 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

112 assert not acl.may(request, u"Someone", "delete") 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

113 assert not acl.may(request, u"Someone", "admin") 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

114 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

115 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

116 coverage_modules = ['MoinMoin.groups.backends.config_group'] 
3b05bf18c0d1
Groups2009: The BackendTest class provides basic test methods for testing backends. It should be inherited to test backends.
Dmitrijs Milajevs <dimazest@gmail.com>
parents:
diff
changeset

117 