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
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])
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
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
def setUp(self): self.client = Client() self.user = UserFactory.create() self.client.force_login(self.user, settings.AUTHENTICATION_BACKENDS[0])
def staff_user(): return UserFactory.create(is_superuser=False, is_staff=True)
def team_user(team_group): user = UserFactory.create(is_superuser=False, is_staff=False) team_group.user_set.add(user) return user
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
def procurement(change_application_status): user = UserFactory.create(is_superuser=False, is_staff=False) user.user_permissions.add(change_application_status) return user