예제 #1
0
def control(add_application, view_budget):
    user = UserFactory.create(is_superuser=False, is_staff=False)
    team, new = Group.objects.get_or_create(name=settings.BUDGET_CONTROL_GROUP)
    team.permissions.add(add_application)
    team.permissions.add(view_budget)
    team.user_set.add(user)
    return user
예제 #2
0
 def setUp(self):
     self.client = Client()
     self.user = UserFactory.create(is_superuser=True,
                                    is_staff=True,
                                    username='******')
     self.client.force_login(self.user, settings.AUTHENTICATION_BACKENDS[0])
예제 #3
0
def authenticated_client(user=None):
    user = user or UserFactory.create(is_superuser=False, is_staff=False)
    client = django.test.Client()
    client.force_login(user, settings.AUTHENTICATION_BACKENDS[0])
    return client
예제 #4
0
def staff_client():
    staff = UserFactory.create(is_superuser=False, is_staff=True)
    client = django.test.Client()
    client.force_login(staff, settings.AUTHENTICATION_BACKENDS[0])
    return client
예제 #5
0
 def setUp(self):
     self.client = Client()
     self.user = UserFactory.create()
     self.client.force_login(self.user, settings.AUTHENTICATION_BACKENDS[0])
예제 #6
0
def staff_user():
    return UserFactory.create(is_superuser=False, is_staff=True)
예제 #7
0
def team_user(team_group):
    user = UserFactory.create(is_superuser=False, is_staff=False)
    team_group.user_set.add(user)
    return user
예제 #8
0
def manager(manager_group, team_group):
    user = UserFactory.create(is_superuser=False, is_staff=False)
    manager_group.user_set.add(user)
    team_group.user_set.add(user)
    return user
예제 #9
0
def procurement(change_application_status):
    user = UserFactory.create(is_superuser=False, is_staff=False)
    user.user_permissions.add(change_application_status)
    return user