Example #1
0
def _has_fulfilled_all_milestones(user, course_id):
    """
    Returns whether the given user has fulfilled all milestones for the
    given course.

    Arguments:
        course_id: ID of the course to check
        user_id: ID of the user to check
    """
    return MilestoneAccessError() if any_unfulfilled_milestones(course_id, user.id) else ACCESS_GRANTED
    def test_any_unfulfilled_milestones(self):
        """
        Tests any_unfulfilled_milestones for invalid arguments with the app enabled.
        """

        # Should not raise any exceptions
        milestones_helpers.any_unfulfilled_milestones(self.course.id, self.user['id'])

        with pytest.raises(InvalidCourseKeyException):
            milestones_helpers.any_unfulfilled_milestones(None, self.user['id'])
        with pytest.raises(InvalidUserException):
            milestones_helpers.any_unfulfilled_milestones(self.course.id, None)