Exemplo n.º 1
0
 def _get_user_by_perm(self, perm):
     group = GroupFactory(
         name=perm.name,
         boundperm_set=(BoundPerm(perm=perm),)
     )
     user = UserFactory(
         is_staff=False,
         is_superuser=False,
         groups=(group,),
     )
     return user
Exemplo n.º 2
0
    def test_user_with_bound_perms_has_access(self):
        user_with_access = UserFactory(
            is_staff=False,
            is_superuser=False,
        )
        BoundPerm(
            profile=user_with_access.get_profile(),
            perm=Perm.has_assets_access,
        ).save()

        client = login_as_user(user_with_access)
        response = client.get(self.assets_module_url, follow=True)
        self.assertEqual(response.status_code, 200)
Exemplo n.º 3
0
 def add_perms(self, perms):
     user_profile = Profile.objects.get(user=self.user)
     for perm in perms:
         BoundPerm(profile=user_profile, perm=perm).save()
Exemplo n.º 4
0
 def add_perms(self, perms):
     """Adds a given permission to the test user"""
     user_profile = Profile.objects.get(user=self.user)
     for perm in perms:
         BoundPerm(profile=user_profile, perm=perm).save()