def test_group_policy_add(self): from easyblog.models import Groups groups = Groups(u'groups', u'main', u'groups') policy = {u'admin': [u'group:admins', u'group:editors'], u'member': [u'group:members', u'group:editors']} groups.add_policy(policy) self.assertEqual(len(groups[u'member']), 3)
def test_group_policy_add(self): from easyblog.models import Groups groups = Groups(u'groups', u'main', u'groups') policy = { u'admin': [u'group:admins', u'group:editors'], u'member': [u'group:members', u'group:editors'] } groups.add_policy(policy) self.assertEqual(len(groups[u'member']), 3)
def test_group_remove_group(self): from easyblog.models import Groups groups = Groups(u'groups', u'main', u'groups') groups.add(u'admin', u'group:admins') groups.add(u'member', u'group:members') groups.add(u'editor', u'group:editors') groups.remove_group(u'member', u'group:members') self.assertTrue(groups['member'] == [])
def test_groups_flusj(self): from .models import Groups groups = Groups(u'groups', u'main', u'groups') groups.add(u'member', u'members:group') groups.flush(u'member') self.assertTrue(groups[u'member'] == [])