def test_user_is_superuser(self):
     testuser = mommy.make(settings.AUTH_USER_MODEL, is_superuser=True)
     selector = htmls.S(listbuilder_role.RoleSelectList(user=testuser).render())
     self.assertFalse(
         selector.exists('.devilry-frontpage-listbuilder-roleselect-itemvalue-student'))
     self.assertFalse(
         selector.exists('.devilry-frontpage-listbuilder-roleselect-itemvalue-examiner'))
     self.assertTrue(
         selector.exists('.devilry-frontpage-listbuilder-roleselect-itemvalue-anyadmin'))
 def test_user_is_periodadmin(self):
     testuser = mommy.make(settings.AUTH_USER_MODEL)
     mommy.make('devilry_account.PermissionGroupUser', user=testuser,
                permissiongroup=mommy.make('devilry_account.PeriodPermissionGroup').permissiongroup)
     selector = htmls.S(listbuilder_role.RoleSelectList(user=testuser).render())
     self.assertFalse(
         selector.exists('.devilry-frontpage-listbuilder-roleselect-itemvalue-student'))
     self.assertFalse(
         selector.exists('.devilry-frontpage-listbuilder-roleselect-itemvalue-examiner'))
     self.assertTrue(
         selector.exists('.devilry-frontpage-listbuilder-roleselect-itemvalue-anyadmin'))
 def test_user_is_examiner(self):
     testuser = mommy.make(settings.AUTH_USER_MODEL)
     mommy.make('core.Examiner',
                relatedexaminer__user=testuser,
                assignmentgroup__parentnode=mommy.make_recipe('devilry.apps.core.assignment_activeperiod_start'))
     selector = htmls.S(listbuilder_role.RoleSelectList(user=testuser).render())
     self.assertFalse(
         selector.exists('.devilry-frontpage-listbuilder-roleselect-itemvalue-student'))
     self.assertTrue(
         selector.exists('.devilry-frontpage-listbuilder-roleselect-itemvalue-examiner'))
     self.assertFalse(
         selector.exists('.devilry-frontpage-listbuilder-roleselect-itemvalue-anyadmin'))
 def test_user_is_departmentadmin(self):
     testuser = mommy.make(settings.AUTH_USER_MODEL)
     mommy.make('devilry_account.PermissionGroupUser', user=testuser,
                permissiongroup=mommy.make(
                    'devilry_account.SubjectPermissionGroup',
                    permissiongroup__grouptype=PermissionGroup.GROUPTYPE_DEPARTMENTADMIN).permissiongroup)
     selector = htmls.S(listbuilder_role.RoleSelectList(user=testuser).render())
     self.assertFalse(
         selector.exists('.devilry-frontpage-listbuilder-roleselect-itemvalue-student'))
     self.assertFalse(
         selector.exists('.devilry-frontpage-listbuilder-roleselect-itemvalue-examiner'))
     self.assertTrue(
         selector.exists('.devilry-frontpage-listbuilder-roleselect-itemvalue-anyadmin'))
Пример #5
0
 def __make_roleselect_list(self):
     return listbuilder_role.RoleSelectList(user=self.request.user)