예제 #1
0
def test_submission_validate_invalid_no_answer_file():
    """
    Test process_answer.submission_validate function.
    """
    submission: dict = {
        "xqueue_files": {},
        "xqueue_body": {
            "grader_payload": "1"
        }
    }

    with pytest.raises(InvalidSubmissionException):
        process_answer.submission_validate(submission)

    submission: dict = {
        "xqueue_files": {
            "student_response.txt": ""
        },
        "xqueue_body": {
            "grader_payload": "1"
        },
    }

    with pytest.raises(InvalidSubmissionException):
        process_answer.submission_validate(submission)
예제 #2
0
def test_submission_validate_valid_body_string():
    """
    Test process_answer.submission_validate function.
    """
    submission: dict = {
        "xqueue_body": '{"student_response": "5", "grader_payload": "1"}'
    }

    process_answer.submission_validate(submission)
예제 #3
0
def test_submission_validate_valid_file_dict():
    """
    Test process_answer.submission_validate function.
    """
    submission: dict = {
        "xqueue_files": '{"student_response.txt": "http://captive.apple.com"}',
        "xqueue_body": {
            "grader_payload": "1"
        },
    }

    process_answer.submission_validate(submission)
예제 #4
0
def test_submission_validate_invalid_no_body():
    """
    Test process_answer.submission_validate function.
    """
    submission: dict = {
        "xqueue_files": {
            "student_response.txt": "http://captive.apple.com"
        }
    }

    with pytest.raises(InvalidSubmissionException):
        process_answer.submission_validate(submission)
예제 #5
0
def test_submission_validate_valid_body_payload_dictionary():
    """
    Test process_answer.submission_validate function.
    """
    submission: dict = {
        "xqueue_body": {
            "student_response": "5",
            "grader_payload": {
                "script_id": "1"
            }
        }
    }

    process_answer.submission_validate(submission)
예제 #6
0
def test_submission_validate_invalid_no_grading_script():
    """
    Test process_answer.submission_validate function.
    """
    submission: dict = {
        "xqueue_files": {
            "student_response.txt": "http://captive.apple.com"
        },
        "xqueue_body": {
            "student_response": "5",
            "grader_payload": "some_script_name"
        },
    }

    with pytest.raises(InvalidSubmissionException):
        process_answer.submission_validate(submission)