def test_non_mobile_available(self, role, should_succeed): """ Tests that the MobileAvailabilityError() is raised for certain user roles when trying to access course content. Also verifies that if the IgnoreMobileAvailableFlagConfig is enabled, MobileAvailabilityError() will not be raised for all user roles. """ self.init_course_access() # set mobile_available to False for the test course self.course.mobile_available = False self.store.update_item(self.course, self.user.id) self._verify_response(should_succeed, MobileAvailabilityError(), role) IgnoreMobileAvailableFlagConfig(enabled=True).save() self._verify_response(True, MobileAvailabilityError(), role)
def _is_descriptor_mobile_available(descriptor): """ Returns if descriptor is available on mobile. """ if IgnoreMobileAvailableFlagConfig.is_enabled() or descriptor.mobile_available: return ACCESS_GRANTED else: return MobileAvailabilityError()