def test_synchronize_all_external_groups(self):
     """webgroup - synchronizing all external groups"""
     from invenio.webgroup import synchronize_all_external_groups
     from invenio.webgroup_dblayer import get_external_groups, \
         get_all_login_method_groups
     synchronize_all_external_groups(
         {'group1': ('descr1', [self.email, self.email2])},
         self.login_method)
     groups = get_external_groups(self.uid2)
     self.assertEqual(len(groups), 1)
     synchronize_all_external_groups(
         {'group2': ('descr1', [self.email, self.email2])},
         self.login_method)
     groups = get_external_groups(self.uid2)
     self.assertEqual(len(groups), 1)
     self.assertEqual(groups[0][1], 'group2')
     self.assertEqual(groups[0][2], 'descr1')
     synchronize_all_external_groups({'group2': ('descr2', [self.email])},
                                     self.login_method)
     groups = get_external_groups(self.uid)
     self.assertEqual(groups[0][2], 'descr2')
     groups = get_external_groups(self.uid)
     self.assertEqual(len(groups), 1)
     self.assertEqual(groups[0][1], 'group2')
     groups = get_external_groups(self.uid2)
     self.assertEqual(len(groups), 0)
     synchronize_all_external_groups({}, self.login_method)
     groups = get_external_groups(self.uid2)
     self.assertEqual(len(groups), 0)
     groups = get_all_login_method_groups(self.login_method)
     self.failIf(groups)
예제 #2
0
 def test_synchronize_all_external_groups(self):
     """webgroup - synchronizing all external groups"""
     from invenio.webgroup import synchronize_all_external_groups
     from invenio.legacy.websession.dblayer import get_external_groups, \
         get_all_login_method_groups
     synchronize_all_external_groups({'group1' : ('descr1', [self.email, self.email2])}, self.login_method)
     groups = get_external_groups(self.uid2)
     self.assertEqual(len(groups), 1)
     synchronize_all_external_groups({'group2' : ('descr1', [self.email, self.email2])}, self.login_method)
     groups = get_external_groups(self.uid2)
     self.assertEqual(len(groups), 1)
     self.assertEqual(groups[0][1], 'group2')
     self.assertEqual(groups[0][2], 'descr1')
     synchronize_all_external_groups({'group2' : ('descr2', [self.email])}, self.login_method)
     groups = get_external_groups(self.uid)
     self.assertEqual(groups[0][2], 'descr2')
     groups = get_external_groups(self.uid)
     self.assertEqual(len(groups), 1)
     self.assertEqual(groups[0][1], 'group2')
     groups = get_external_groups(self.uid2)
     self.assertEqual(len(groups), 0)
     synchronize_all_external_groups({}, self.login_method)
     groups = get_external_groups(self.uid2)
     self.assertEqual(len(groups), 0)
     groups = get_all_login_method_groups(self.login_method)
     self.failIf(groups)
 def test_synchronize_all_external_groups(self):
     """webgroup - synchronizing all external groups"""
     synchronize_all_external_groups({'group1' : ('descr1', [self.email, self.email2])}, self.login_method)
     groups = get_external_groups(self.uid2)
     self.assertEqual(len(groups), 1)
     synchronize_all_external_groups({'group2' : ('descr1', [self.email, self.email2])}, self.login_method)
     groups = get_external_groups(self.uid2)
     self.assertEqual(len(groups), 1)
     self.assertEqual(groups[0][1], 'group2')
     self.assertEqual(groups[0][2], 'descr1')
     synchronize_all_external_groups({'group2' : ('descr2', [self.email])}, self.login_method)
     groups = get_external_groups(self.uid)
     self.assertEqual(groups[0][2], 'descr2')
     groups = get_external_groups(self.uid)
     self.assertEqual(len(groups), 1)
     self.assertEqual(groups[0][1], 'group2')
     groups = get_external_groups(self.uid2)
     self.assertEqual(len(groups), 0)
     synchronize_all_external_groups({}, self.login_method)
     groups = get_external_groups(self.uid2)
     self.assertEqual(len(groups), 0)
     groups = get_all_login_method_groups(self.login_method)
     self.failIf(groups)
 def test_synchronize_all_external_groups(self):
     """webgroup - synchronizing all external groups"""
     synchronize_all_external_groups({"group1": ("descr1", [self.email, self.email2])}, self.login_method)
     groups = get_external_groups(self.uid2)
     self.assertEqual(len(groups), 1)
     synchronize_all_external_groups({"group2": ("descr1", [self.email, self.email2])}, self.login_method)
     groups = get_external_groups(self.uid2)
     self.assertEqual(len(groups), 1)
     self.assertEqual(groups[0][1], "group2")
     self.assertEqual(groups[0][2], "descr1")
     synchronize_all_external_groups({"group2": ("descr2", [self.email])}, self.login_method)
     groups = get_external_groups(self.uid)
     self.assertEqual(groups[0][2], "descr2")
     groups = get_external_groups(self.uid)
     self.assertEqual(len(groups), 1)
     self.assertEqual(groups[0][1], "group2")
     groups = get_external_groups(self.uid2)
     self.assertEqual(len(groups), 0)
     synchronize_all_external_groups({}, self.login_method)
     groups = get_external_groups(self.uid2)
     self.assertEqual(len(groups), 0)
     groups = get_all_login_method_groups(self.login_method)
     self.failIf(groups)