示例#1
0
    def test_check_for_combined_notifications(self):
        notification_dict = {
            'course_id' : 'course_id',
            'user_is_staff' : False,
            'last_time_viewed' : datetime.datetime.now() - datetime.timedelta(minutes=10),
            'student_id' : STUDENT_ID
        }

        success, combined_notifications = grader_util.check_for_combined_notifications(notification_dict)
        self.assertEqual(len(combined_notifications.keys()), 3)

        notification_dict['user_is_staff'] = True
        success, combined_notifications = grader_util.check_for_combined_notifications(notification_dict)
        self.assertEqual(len(combined_notifications.keys()), 5)
示例#2
0
    def test_check_for_combined_notifications(self):
        notification_dict = {
            'course_id' : 'course_id',
            'user_is_staff' : False,
            'last_time_viewed' : datetime.datetime.now() - datetime.timedelta(minutes=10),
            'student_id' : STUDENT_ID
        }

        success, combined_notifications = grader_util.check_for_combined_notifications(notification_dict)
        self.assertEqual(len(combined_notifications.keys()), 3)

        notification_dict['user_is_staff'] = True
        success, combined_notifications = grader_util.check_for_combined_notifications(notification_dict)
        self.assertEqual(len(combined_notifications.keys()), 5)
示例#3
0
文件: tests.py 项目: Neodemia/edx-ora
    def test_check_for_combined_notifications(self):
        notification_dict = {
            "course_id": "course_id",
            "user_is_staff": False,
            "last_time_viewed": datetime.datetime.now() - datetime.timedelta(minutes=10),
            "student_id": STUDENT_ID,
        }

        success, combined_notifications = grader_util.check_for_combined_notifications(notification_dict)
        self.assertEqual(len(combined_notifications.keys()), 3)

        notification_dict["user_is_staff"] = True
        success, combined_notifications = grader_util.check_for_combined_notifications(notification_dict)
        self.assertEqual(len(combined_notifications.keys()), 5)
示例#4
0
文件: views.py 项目: pombreda/edx-ora
def check_for_notifications(request):
    """
    Check if a given problem name, location tuple is unique
    Input:
        A problem location and the problem name
    Output:
        Dictionary containing success, and and indicator of whether or not the name is unique
    """
    if request.method != 'GET':
        return util._error_response("Request type must be GET",
                                    _INTERFACE_VERSION)

    for tag in [
            'course_id', 'user_is_staff', 'last_time_viewed', 'student_id'
    ]:
        if tag not in request.GET:
            return util._error_response("Missing required key {0}".format(tag),
                                        _INTERFACE_VERSION)

    request_dict = request.GET.copy()
    success, combined_notifications = grader_util.check_for_combined_notifications(
        request_dict)

    if not success:
        return util._error_response(combined_notifications, _INTERFACE_VERSION)

    util.log_connection_data()
    return util._success_response(combined_notifications, _INTERFACE_VERSION)
示例#5
0
文件: views.py 项目: EDUlib/edx-ora
def check_for_notifications(request):
    """
    Check if a given problem name, location tuple is unique
    Input:
        A problem location and the problem name
    Output:
        Dictionary containing success, and and indicator of whether or not the name is unique
    """
    if request.method != 'GET':
        return util._error_response("Request type must be GET", _INTERFACE_VERSION)

    for tag in ['course_id', 'user_is_staff', 'last_time_viewed', 'student_id']:
        if tag not in request.GET:
            return util._error_response("Missing required key {0}".format(tag), _INTERFACE_VERSION)

    request_dict = request.GET.copy()
    success, combined_notifications = grader_util.check_for_combined_notifications(request_dict)

    if not success:
        return util._error_response(combined_notifications,_INTERFACE_VERSION)

    util.log_connection_data()
    return util._success_response(combined_notifications, _INTERFACE_VERSION)