# Path: groups_manager/models.py
# def get_auth_models_sync_func_default(instance):
#     def group_model(self):
#     def group_member_model(self):
#     def __unicode__(self):
#     def __str__(self):
#     def save(self, *args, **kwargs):
#     def full_name(self):
#     def groups(self):
#     def has_perm(self, perm, obj=None):
#     def has_perms(self, perm_list, obj=None):
#     def assign_object(self, group, obj, **kwargs):
# def member_save(sender, instance, created, *args, **kwargs):
# def member_delete(sender, instance, *args, **kwargs):
#     def __unicode__(self):
#     def __str__(self):
#     def save(self, *args, **kwargs):
#     def groups(self):
#     def __unicode__(self):
#     def __str__(self):
#     def save(self, *args, **kwargs):
#     def groups(self):
#     def member_model(self):
#     def group_member_model(self):
#     def group_members_attribute(self):
#     def __unicode__(self):
#     def __str__(self):
#     def save(self, *args, **kwargs):
#     def _get_full_name(self):
#     def subgroups(self):
#     def get_members(self, subgroups=False):
#     def members(self):
#     def users(self):
#     def get_entities(self, subgroups=False):
#     def entities(self):
#     def add_member(self, member, roles=None, expiration_date=None):
#     def remove_member(self, member):
#     def assign_object(self, obj, **kwargs):
# def group_save(sender, instance, created, *args, **kwargs):
# def group_delete(sender, instance, *args, **kwargs):
#     def __unicode__(self):
#     def __str__(self):
#     def save(self, *args, **kwargs):
#     def __unicode__(self):
#     def __str__(self):
#     def assign_object(self, obj, **kwargs):
# def group_member_save(sender, instance, created, *args, **kwargs):
# def group_member_delete(sender, instance, *args, **kwargs):
# class MemberRelationsMixin(object):
#     class GroupsManagerMeta:
# class MemberMixin(MemberRelationsMixin, models.Model):
#     class Meta:
# class Member(MemberMixin):
#     class Meta(MemberMixin.Meta):
# class GroupTypeMixin(models.Model):
#     class Meta:
# class GroupType(GroupTypeMixin):
#     class Meta(GroupTypeMixin.Meta):
# class GroupEntityMixin(models.Model):
#     class Meta:
# class GroupEntity(GroupEntityMixin):
#     class Meta(GroupEntityMixin.Meta):
# class GroupRelationsMixin(object):
#     class GroupsManagerMeta:
# class GroupMixin(GroupRelationsMixin, MPTTModel):
#     class Meta:
#     class MPTTMeta:
#     class GroupsManagerMeta(GroupRelationsMixin.GroupsManagerMeta):
# class Group(GroupMixin):
#     class Meta(GroupMixin.Meta):
# class GroupMemberRoleMixin(models.Model):
#     class Meta:
# class GroupMemberRole(GroupMemberRoleMixin):
#     class Meta(GroupMemberRoleMixin.Meta):
# class GroupMemberMixin(models.Model):
#     class Meta:
# class GroupMember(GroupMemberMixin):
#     class Meta(GroupMemberMixin.Meta):
# 
# Path: groups_manager/exceptions_gm.py
# class MemberDjangoUserSyncError(BaseException):
# class GroupDjangoGroupSyncError(BaseException):
# class GroupNotSavedError(BaseException):
# class MemberNotSavedError(BaseException):
# class GetGroupMemberError(BaseException):
# class GetRoleError(BaseException):


from copy import deepcopy
from django.contrib.auth import models as auth_models
from django.test import TestCase
from groups_manager import models, exceptions_gm
from testproject import models as testproject_models
        from groups_manager import settings
        from groups_manager import settings
        from groups_manager import settings
        from groups_manager import settings
        from groups_manager import settings
        from groups_manager import settings
        from groups_manager import settings
        from groups_manager import settings
        from groups_manager import settings
        from groups_manager import settings
        from groups_manager import settings
        from groups_manager import settings
        from groups_manager import settings
import re
import unittest
    import guardian
        john_boss = testproject_models.OrganizationMemberSubclass.objects.create(
            first_name='John', last_name='Boss', phone_number='033 32 33 34')
        organization.add_member(john_boss)
        org_members = organization.members
        self.assertIsInstance(org_members[0], testproject_models.OrganizationMemberSubclass)

    def test_signals_kwargs(self):
        settings.GROUPS_MANAGER = deepcopy(GROUPS_MANAGER_MOCK)
        settings.GROUPS_MANAGER['AUTH_MODELS_SYNC'] = False

        # TEST 'get_auth_models_sync_func'
        # default signal
        w = testproject_models.WorkGroup(name='New workgroup')
        w.save()
        self.assertIsNone(w.django_group)
        # test signal wrapping
        pg = testproject_models.ProjectGroup(name='Project group')
        pg.save()
        self.assertIsNotNone(pg.django_group)
        self.assertTrue(pg.django_group.name.startswith('PGS_'))
        self.assertTrue(pg.django_group.name.endswith('_Project'))
        pm = testproject_models.ProjectMember(first_name='Mike', last_name='Miky')
        pm.save()
        self.assertTrue(pm.django_user.username.startswith('PGS_'))
        self.assertTrue(pm.django_user.username.endswith('_Project'))
        self.assertIsNotNone(pm.django_user)
        pg.add_member(pm)
        self.assertTrue(pg.django_group in pm.django_user.groups.all())
        pg.remove_member(pm)
        # Test catch exception

# Path: groups_manager/models.py
# def get_auth_models_sync_func_default(instance):
#     def group_model(self):
#     def group_member_model(self):
#     def __unicode__(self):
#     def __str__(self):
#     def save(self, *args, **kwargs):
#     def full_name(self):
#     def groups(self):
#     def has_perm(self, perm, obj=None):
#     def has_perms(self, perm_list, obj=None):
#     def assign_object(self, group, obj, **kwargs):
# def member_save(sender, instance, created, *args, **kwargs):
# def member_delete(sender, instance, *args, **kwargs):
#     def __unicode__(self):
#     def __str__(self):
#     def save(self, *args, **kwargs):
#     def groups(self):
#     def __unicode__(self):
#     def __str__(self):
#     def save(self, *args, **kwargs):
#     def groups(self):
#     def member_model(self):
#     def group_member_model(self):
#     def group_members_attribute(self):
#     def __unicode__(self):
#     def __str__(self):
#     def save(self, *args, **kwargs):
#     def _get_full_name(self):
#     def subgroups(self):
#     def get_members(self, subgroups=False):
#     def members(self):
#     def users(self):
#     def get_entities(self, subgroups=False):
#     def entities(self):
#     def add_member(self, member, roles=None, expiration_date=None):
#     def remove_member(self, member):
#     def assign_object(self, obj, **kwargs):
# def group_save(sender, instance, created, *args, **kwargs):
# def group_delete(sender, instance, *args, **kwargs):
#     def __unicode__(self):
#     def __str__(self):
#     def save(self, *args, **kwargs):
#     def __unicode__(self):
#     def __str__(self):
#     def assign_object(self, obj, **kwargs):
# def group_member_save(sender, instance, created, *args, **kwargs):
# def group_member_delete(sender, instance, *args, **kwargs):
# class MemberRelationsMixin(object):
#     class GroupsManagerMeta:
# class MemberMixin(MemberRelationsMixin, models.Model):
#     class Meta:
# class Member(MemberMixin):
#     class Meta(MemberMixin.Meta):
# class GroupTypeMixin(models.Model):
#     class Meta:
# class GroupType(GroupTypeMixin):
#     class Meta(GroupTypeMixin.Meta):
# class GroupEntityMixin(models.Model):
#     class Meta:
# class GroupEntity(GroupEntityMixin):
#     class Meta(GroupEntityMixin.Meta):
# class GroupRelationsMixin(object):
#     class GroupsManagerMeta:
# class GroupMixin(GroupRelationsMixin, MPTTModel):
#     class Meta:
#     class MPTTMeta:
#     class GroupsManagerMeta(GroupRelationsMixin.GroupsManagerMeta):
# class Group(GroupMixin):
#     class Meta(GroupMixin.Meta):
# class GroupMemberRoleMixin(models.Model):
#     class Meta:
# class GroupMemberRole(GroupMemberRoleMixin):
#     class Meta(GroupMemberRoleMixin.Meta):
# class GroupMemberMixin(models.Model):
#     class Meta:
# class GroupMember(GroupMemberMixin):
#     class Meta(GroupMemberMixin.Meta):
# 
# Path: groups_manager/exceptions_gm.py
# class MemberDjangoUserSyncError(BaseException):
# class GroupDjangoGroupSyncError(BaseException):
# class GroupNotSavedError(BaseException):
# class MemberNotSavedError(BaseException):
# class GetGroupMemberError(BaseException):
# class GetRoleError(BaseException):


# Path: testproject/testproject/tests.py
from copy import deepcopy
from django.contrib.auth import models as auth_models
from django.test import TestCase
from groups_manager import models, exceptions_gm
from testproject import models as testproject_models
        from groups_manager import settings
        from groups_manager import settings
        from groups_manager import settings
        from groups_manager import settings
        from groups_manager import settings
        from groups_manager import settings
        from groups_manager import settings
        from groups_manager import settings
        from groups_manager import settings
        from groups_manager import settings
        from groups_manager import settings
        from groups_manager import settings
        from groups_manager import settings
import re
import unittest
    import guardian

        john_boss = testproject_models.OrganizationMemberSubclass.objects.create(
            first_name='John', last_name='Boss', phone_number='033 32 33 34')
        organization.add_member(john_boss)
        org_members = organization.members
        self.assertIsInstance(org_members[0], testproject_models.OrganizationMemberSubclass)

    def test_signals_kwargs(self):
        settings.GROUPS_MANAGER = deepcopy(GROUPS_MANAGER_MOCK)
        settings.GROUPS_MANAGER['AUTH_MODELS_SYNC'] = False

        # TEST 'get_auth_models_sync_func'
        # default signal
        w = testproject_models.WorkGroup(name='New workgroup')
        w.save()
        self.assertIsNone(w.django_group)
        # test signal wrapping
        pg = testproject_models.ProjectGroup(name='Project group')
        pg.save()
        self.assertIsNotNone(pg.django_group)
        self.assertTrue(pg.django_group.name.startswith('PGS_'))
        self.assertTrue(pg.django_group.name.endswith('_Project'))
        pm = testproject_models.ProjectMember(first_name='Mike', last_name='Miky')
        pm.save()
        self.assertTrue(pm.django_user.username.startswith('PGS_'))
        self.assertTrue(pm.django_user.username.endswith('_Project'))
        self.assertIsNotNone(pm.django_user)
        pg.add_member(pm)
        self.assertTrue(pg.django_group in pm.django_user.groups.all())
        pg.remove_member(pm)
        # Test catch exception

        with self.assertRaises(exceptions_gm.GetGroupMemberError):