コード例 #1
0
 def setUp(self):
     self.maxDiff = None
     self.member = models.Member(
         first_name='Lucio',
         last_name='Silla',
         username='******',
     )
コード例 #2
0
 def test_add_member(self):
     dictators = models.Group(name='Dictators')
     dictators.save()
     sulla = models.Member(first_name='Lucius', last_name='Sulla')
     sulla.save()
     membership = dictators.add_member(sulla)
     self.assertEqual(membership.group, dictators)
     self.assertEqual(membership.member, sulla)
コード例 #3
0
 def test_users_without_model_sync(self):
     from groups_manager import settings
     settings.GROUPS_MANAGER = deepcopy(GROUPS_MANAGER_MOCK)
     settings.GROUPS_MANAGER['AUTH_MODELS_SYNC'] = False
     dictators = models.Group(name='Dictators')
     dictators.save()
     sulla = models.Member(first_name='Lucius', last_name='Sulla')
     sulla.save()
     dictators.add_member(sulla)
     self.assertEqual(dictators.users, [])
コード例 #4
0
 def test_group_member_model(self):
     member = models.Member(first_name='Caio', last_name='Mario')
     self.assertEqual(member.group_member_model, models.GroupMember)
コード例 #5
0
 def test_has_perms_exception(self):
     member = models.Member(first_name='Caio', last_name='Mario')
     with self.assertRaises(exceptions_gm.MemberDjangoUserSyncError):
         member.has_perms(['view_member'], member)
コード例 #6
0
 def test_add_member_unsaved_member(self):
     dictators = models.Group.objects.create(name='Dictators')
     sulla = models.Member(first_name='Lucius', last_name='Sulla')
     with self.assertRaises(exceptions_gm.MemberNotSavedError):
         dictators.add_member(sulla)