예제 #1
0
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()
예제 #2
0
 def setUp(self):
     super(MobileAPITestCase, self).setUp()
     self.course = CourseFactory.create(
         mobile_available=True, static_asset_path="needed_for_split")
     self.user = UserFactory.create()
     self.password = '******'
     self.username = self.user.username
     IgnoreMobileAvailableFlagConfig(enabled=False).save()
예제 #3
0
파일: testutils.py 프로젝트: saadow123/1
 def setUp(self):
     super(MobileAPITestCase, self).setUp()
     self.course = CourseFactory.create(
         mobile_available=True,
         static_asset_path="needed_for_split",
         end=datetime.datetime.now(pytz.UTC),
         certificate_available_date=datetime.datetime.now(pytz.UTC))
     self.user = UserFactory.create()
     self.password = '******'
     self.username = self.user.username
     self.api_version = API_V1
     IgnoreMobileAvailableFlagConfig(enabled=False).save()
예제 #4
0
 def setUp(self):
     super(MobileAPITestCase, self).setUp()
     self.course = CourseFactory.create(
         mobile_available=True,
         static_asset_path="needed_for_split",
         # Custom change: course end date is set to a future date to fulfill custom added feature flag
         # ALLOW_STUDENT_STATE_UPDATES_ON_CLOSED_COURSE
         end=datetime.datetime.now(pytz.UTC) + datetime.timedelta(days=1),
         certificate_available_date=datetime.datetime.now(pytz.UTC))
     self.user = UserFactory.create()
     self.password = '******'
     self.username = self.user.username
     self.api_version = API_V1
     IgnoreMobileAvailableFlagConfig(enabled=False).save()
예제 #5
0
    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)