示例#1
0
 def test_populate_user_from_entry_affiliation(self):
     owner = Owner.objects.get(user__username="******")
     user = User.objects.get(username="******")
     self.assertEqual(user.owner, owner)
     reload(populatedCASbackend)
     populatedCASbackend.populate_user_from_entry(user, owner, self.entry)
     self.assertEqual(AccessGroup.objects.all().count(), 3)
     self.assertTrue(
         user.owner.accessgroup_set.filter(
             code_name__in=["member", "staff"]).exists())
     print(" --->  test_populate_user_from_entry_affiliation"
           " of PopulatedLDAPTestCase : OK !")
示例#2
0
 def test_populate_user_from_entry(self):
     owner = Owner.objects.get(user__username="******")
     user = User.objects.get(username="******")
     self.assertEqual(user.owner, owner)
     reload(populatedCASbackend)
     populatedCASbackend.populate_user_from_entry(user, owner, self.entry)
     self.assertEqual(user.email, "*****@*****.**")
     self.assertEqual(user.first_name, "Univ")
     self.assertEqual(user.last_name, "Pod")
     # CREATE_GROUP_FROM_AFFILIATION = getattr(
     #    settings, 'CREATE_GROUP_FROM_AFFILIATION', False)
     # CREATE_GROUP_FROM_GROUPS = getattr(
     #    settings, 'CREATE_GROUP_FROM_GROUPS', False)
     # check no group are created any from affiliation or groups
     self.assertEqual(user.is_staff, True)
     self.assertEqual(AccessGroup.objects.all().count(), 1)
     self.assertEqual(user.owner.accessgroup_set.all().count(), 0)
     print(" --->  test_populate_user_from_entry by default"
           " of PopulatedLDAPTestCase : OK !")