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)
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)
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)
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)
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)
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)