def setUp(self): self.maxDiff = None self.member = models.Member( first_name='Lucio', last_name='Silla', username='******', )
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)
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, [])
def test_group_member_model(self): member = models.Member(first_name='Caio', last_name='Mario') self.assertEqual(member.group_member_model, models.GroupMember)
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)
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)