Back to index

moin  1.9.0~rc2
Classes | Public Member Functions | Static Public Attributes
MoinMoin.datastruct.backends._tests.test_config_groups.TestConfigGroupsBackend Class Reference
Inheritance diagram for MoinMoin.datastruct.backends._tests.test_config_groups.TestConfigGroupsBackend:
Inheritance graph
[legend]
Collaboration diagram for MoinMoin.datastruct.backends._tests.test_config_groups.TestConfigGroupsBackend:
Collaboration graph
[legend]

List of all members.

Classes

class  Config

Public Member Functions

def test_contains
def test_contains_group
def test_iter
def test_get
def test_groups_with_member
def test_backend_acl_allow
def test_backend_acl_deny
def test_backend_acl_with_all
def test_backend_acl_not_existing_group

Static Public Attributes

dictionary test_groups
dictionary expanded_groups

Detailed Description

Definition at line 14 of file test_config_groups.py.


Member Function Documentation

Test if the wiki group backend works with acl code.
Check user which has rights.

Definition at line 86 of file __init__.py.

00086 
00087     def test_backend_acl_allow(self):
00088         """
00089         Test if the wiki group backend works with acl code.
00090         Check user which has rights.
00091         """
00092         request = self.request
00093 
00094         acl_rights = ["AdminGroup:admin,read,write"]
00095         acl = security.AccessControlList(request.cfg, acl_rights)
00096 
00097         for user in self.expanded_groups['AdminGroup']:
00098             for permission in ["read", "write", "admin"]:
00099                 assert acl.may(request, u"Admin1", permission), '%s must have %s permission because he is member of the AdminGroup' % (user, permission)

Here is the call graph for this function:

Test if the wiki group backend works with acl code.
Check user which does not have rights.

Definition at line 100 of file __init__.py.

00100 
00101     def test_backend_acl_deny(self):
00102         """
00103         Test if the wiki group backend works with acl code.
00104         Check user which does not have rights.
00105         """
00106         request = self.request
00107 
00108         acl_rights = ["AdminGroup:read,write"]
00109         acl = security.AccessControlList(request.cfg, acl_rights)
00110 
00111         assert u"SomeUser" not in request.groups['AdminGroup']
00112         for permission in ["read", "write"]:
00113             assert not acl.may(request, u"SomeUser", permission), 'SomeUser must not have %s permission because he is not listed in the AdminGroup' % permission
00114 
00115         assert u'Admin1' in request.groups['AdminGroup']
00116         assert not acl.may(request, u"Admin1", "admin")

Here is the call graph for this function:

Definition at line 131 of file __init__.py.

00131 
00132     def test_backend_acl_not_existing_group(self):
00133         request = self.request
00134         assert u'NotExistingGroup' not in request.groups
00135 
00136         acl_rights = ["NotExistingGroup:read,write,delete,admin All:read"]
00137         acl = security.AccessControlList(request.cfg, acl_rights)
00138 
00139         assert not acl.may(request, u"Someone", "write")
00140 

Here is the call graph for this function:

Definition at line 117 of file __init__.py.

00117 
00118     def test_backend_acl_with_all(self):
00119         request = self.request
00120 
00121         acl_rights = ["EditorGroup:read,write,delete,admin All:read"]
00122         acl = security.AccessControlList(request.cfg, acl_rights)
00123 
00124         for member in self.expanded_groups[u'EditorGroup']:
00125             for permission in ["read", "write", "delete", "admin"]:
00126                 assert acl.may(request, member, permission)
00127 
00128         assert acl.may(request, u"Someone", "read")
00129         for permission in ["write", "delete", "admin"]:
00130             assert not acl.may(request, u"Someone", permission)

Here is the call graph for this function:

Test group_wiki Backend and Group containment methods.

Definition at line 41 of file __init__.py.

00041 
00042     def test_contains(self):
00043         """
00044         Test group_wiki Backend and Group containment methods.
00045         """
00046         groups = self.request.groups
00047 
00048         for group, members in self.expanded_groups.iteritems():
00049             assert group in groups
00050             for member in members:
00051                 assert member in groups[group]
00052 
00053         raises(GroupDoesNotExistError, lambda: groups[u'NotExistingGroup'])

Reimplemented in MoinMoin.datastruct.backends._tests.test_lazy_config_groups.TestLazyConfigGroups.

Definition at line 54 of file __init__.py.

00054 
00055     def test_contains_group(self):
00056         groups = self.request.groups
00057 
00058         assert u'AdminGroup' in groups[u'EditorGroup']
00059         assert u'EditorGroup' not in groups[u'AdminGroup']

Definition at line 69 of file __init__.py.

00069 
00070     def test_get(self):
00071         groups = self.request.groups
00072 
00073         assert groups.get(u'AdminGroup')
00074         assert u'NotExistingGroup' not in groups
00075         assert groups.get(u'NotExistingGroup') is None
00076         assert groups.get(u'NotExistingGroup', []) == []

Definition at line 77 of file __init__.py.

00077 
00078     def test_groups_with_member(self):
00079         groups = self.request.groups
00080 
00081         john_groups = list(groups.groups_with_member(u'John'))
00082         assert 2 == len(john_groups)
00083         assert u'EditorGroup' in john_groups
00084         assert u'AdminGroup' in john_groups
00085         assert u'ThirdGroup' not in john_groups

Definition at line 60 of file __init__.py.

00060 
00061     def test_iter(self):
00062         groups = self.request.groups
00063 
00064         for group, members in self.expanded_groups.iteritems():
00065             returned_members = list(groups[group])
00066             assert len(returned_members) == len(members)
00067             for member in members:
00068                 assert member in returned_members


Member Data Documentation

Initial value:
{u'EditorGroup': [u'Admin1', u'Admin2', u'John',
                                        u'JoeDoe', u'Editor1'],
                       u'AdminGroup': [u'Admin1', u'Admin2', u'John'],
                       u'OtherGroup': [u'SomethingOther'],
                       u'RecursiveGroup': [u'Anything', u'Something', u'NotExistingGroup'],
                       u'OtherRecursiveGroup': [u'Anything', u'Something', u'NotExistingGroup'],
                       u'ThirdRecursiveGroup': [u'Banana'],
                       u'EmptyGroup': [],
                       u'CheckNotExistingGroup': [u'NotExistingGroup']}

Reimplemented in MoinMoin.datastruct.backends._tests.test_lazy_config_groups.TestLazyConfigGroups.

Definition at line 31 of file __init__.py.

Initial value:
{u'EditorGroup': [u'AdminGroup', u'John', u'JoeDoe', u'Editor1', u'John'],
                   u'AdminGroup': [u'Admin1', u'Admin2', u'John'],
                   u'OtherGroup': [u'SomethingOther'],
                   u'RecursiveGroup': [u'Something', u'OtherRecursiveGroup'],
                   u'OtherRecursiveGroup': [u'RecursiveGroup', u'Anything', u'NotExistingGroup'],
                   u'ThirdRecursiveGroup': [u'ThirdRecursiveGroup', u'Banana'],
                   u'EmptyGroup': [],
                   u'CheckNotExistingGroup': [u'NotExistingGroup']}

Reimplemented in MoinMoin.datastruct.backends._tests.test_lazy_config_groups.TestLazyConfigGroups.

Definition at line 21 of file __init__.py.


The documentation for this class was generated from the following file: