Пример #1
0
 def login(self):
     profile = UserProfileFactory(user__username='******',
                                  user__password='******')
     user = profile.user
     success = self.client.login(username=user.username, password='******')
     self.assertTrue(success)
     return user
Пример #2
0
def populate_users():
    """
    Create and returns a list of user, each one belonging to a relevant group.
    Create those group if needed.
    """

    users_to_create = [
        { 'username': '******' , 'groups': [GROUP_PATH_MANAGER] },
        { 'username': '******' , 'groups': [GROUP_TREKKING_MANAGER] },
        { 'username': '******'       , 'groups': [GROUP_EDITOR] },
    ]

    # Get or create all needed relevant groups
    populate_groups()

    created_user_profiles = []

    for user in users_to_create:
        created_user_profiles.append(
            UserProfileFactory(
                user__username=user['username'],
                user__groups=Group.objects.filter(name__in=user['groups']),
        ))

    return created_user_profiles
Пример #3
0
 def setUp(self):
     profile = UserProfileFactory.create(user__username='******',
                                         user__password='******')
     user = profile.user
     user.groups.add(Group.objects.get(name=u"Référents communication"))
     self.client.login(username=user.username, password='******')
     self.event1 = TouristicEventFactory.create()
     structure = StructureFactory.create()
     self.event2 = TouristicEventFactory.create(structure=structure)
Пример #4
0
 def setUp(self):
     profile = UserProfileFactory.create(user__username='******',
                                         user__password='******')
     user = profile.user
     user.groups.add(Group.objects.get(name=u"Référents communication"))
     self.client.login(username=user.username, password='******')
     self.content1 = POIFactory.create()
     structure = StructureFactory.create()
     self.content2 = POIFactory.create(structure=structure)
Пример #5
0
 def setUp(self):
     profile = UserProfileFactory.create(user__username='******',
                                         user__password='******')
     user = profile.user
     user.user_permissions.add(Permission.objects.get(codename="add_sensitivearea"))
     user.user_permissions.add(Permission.objects.get(codename="change_sensitivearea"))
     user.user_permissions.add(Permission.objects.get(codename="delete_sensitivearea"))
     user.user_permissions.add(Permission.objects.get(codename="read_sensitivearea"))
     user.user_permissions.add(Permission.objects.get(codename="export_sensitivearea"))
     self.client.login(username=user.username, password='******')
     self.area1 = SensitiveAreaFactory.create()
     structure = StructureFactory.create()
     self.area2 = SensitiveAreaFactory.create(structure=structure)
Пример #6
0
 def setUp(self):
     profile = UserProfileFactory.create(user__username='******',
                                         user__password='******')
     user = profile.user
     user.user_permissions.add(Permission.objects.get(codename=u"add_sensitivearea"))
     user.user_permissions.add(Permission.objects.get(codename=u"change_sensitivearea"))
     user.user_permissions.add(Permission.objects.get(codename=u"delete_sensitivearea"))
     user.user_permissions.add(Permission.objects.get(codename=u"read_sensitivearea"))
     user.user_permissions.add(Permission.objects.get(codename=u"export_sensitivearea"))
     self.client.login(username=user.username, password='******')
     self.area1 = SensitiveAreaFactory.create()
     structure = StructureFactory.create()
     self.area2 = SensitiveAreaFactory.create(structure=structure)