Beispiel #1
0
 def test_get_course_creator_status_disable_creation(self):
     # DISABLE_COURSE_CREATION is True (this is the case on edx, where we have a marketing site).
     # Only edx staff can create courses.
     with mock.patch.dict('django.conf.settings.MITX_FEATURES', self.disable_course_creation):
         self.assertTrue(self.user.is_staff)
         self.assertEquals('granted', _get_course_creator_status(self.user))
         self._set_user_non_staff()
         self.assertFalse(self.user.is_staff)
         self.assertEquals('disallowed_for_this_site', _get_course_creator_status(self.user))
Beispiel #2
0
 def test_get_course_creator_status_creator_group(self):
     # ENABLE_CREATOR_GROUP is True. This is the case on edge.
     # Only staff members and users who have been granted access can create courses.
     with mock.patch.dict('django.conf.settings.MITX_FEATURES', self.enable_creator_group):
         # Staff members can always create courses.
         self.assertEquals('granted', _get_course_creator_status(self.user))
         # Non-staff must request access.
         self._set_user_non_staff()
         self.assertEquals('unrequested', _get_course_creator_status(self.user))
         # Staff user requests access.
         self.client.post(self.request_access_url)
         self.assertEquals('pending', _get_course_creator_status(self.user))
Beispiel #3
0
 def test_get_course_creator_status_creator_group_denied(self):
     # ENABLE_CREATOR_GROUP is True. This is the case on edge.
     # Check return value for a non-staff user who has been denied access.
     with mock.patch.dict('django.conf.settings.MITX_FEATURES', self.enable_creator_group):
         self._set_user_non_staff()
         self._set_user_denied()
         self.assertEquals('denied', _get_course_creator_status(self.user))
Beispiel #4
0
 def test_get_course_creator_status_default_cause(self):
     # Neither ENABLE_CREATOR_GROUP nor DISABLE_COURSE_CREATION are enabled. Anyone can create a course.
     self.assertEquals('granted', _get_course_creator_status(self.user))
     self._set_user_non_staff()
     self.assertEquals('granted', _get_course_creator_status(self.user))