@@ -310,6 +310,104 @@ def test_question_without_correct_code(self):
310310 self .assertEqual (resp .status_code , 200 )
311311 self .assertResponseContextAnswerFeedbackCorrectnessEquals (resp , 1 )
312312
313+ def test_data_files_missing_random_question_data_file_octave (self ):
314+ file_name = "foo"
315+ markdown = (
316+ markdowns .OCTAVE_CODE_MARKDWON_PATTERN_WITH_DATAFILES
317+ % {"extra_data_file" : "- %s" % file_name }
318+ )
319+ resp = self .get_page_sandbox_preview_response (markdown )
320+ self .assertEqual (resp .status_code , 200 )
321+ self .assertSandboxNotHasValidPage (resp )
322+ self .assertResponseContextContains (
323+ resp , PAGE_ERRORS , "data file '%s' not found" % file_name )
324+
325+ def test_data_files_missing_random_question_data_file_bad_format_octave (self ):
326+ markdown = markdowns .OCTAVE_CODE_MARKDWON_WITH_DATAFILES_BAD_FORMAT
327+ resp = self .get_page_sandbox_preview_response (markdown )
328+ self .assertEqual (resp .status_code , 200 )
329+ self .assertSandboxNotHasValidPage (resp )
330+ self .assertResponseContextContains (
331+ resp , PAGE_ERRORS , "data file '%s' not found" % "['foo', 'bar']" )
332+
333+ def test_not_multiple_submit_warning_octave (self ):
334+ markdown = (
335+ markdowns .OCTAVE_CODE_MARKDWON_PATTERN_WITH_DATAFILES
336+ % {"extra_data_file" : "" }
337+ )
338+ resp = self .get_page_sandbox_preview_response (markdown )
339+ self .assertEqual (resp .status_code , 200 )
340+ self .assertSandboxHasValidPage (resp )
341+ self .assertSandboxWarningTextContain (
342+ resp ,
343+ NOT_ALLOW_MULTIPLE_SUBMISSION_WARNING
344+ )
345+
346+ def test_not_multiple_submit_warning2_octave (self ):
347+ markdown = markdowns .OCTAVE_CODE_MARKDWON_NOT_EXPLICITLY_NOT_ALLOW_MULTI_SUBMIT1
348+ resp = self .get_page_sandbox_preview_response (markdown )
349+ self .assertEqual (resp .status_code , 200 )
350+ self .assertSandboxHasValidPage (resp )
351+ self .assertSandboxWarningTextContain (
352+ resp ,
353+ NOT_ALLOW_MULTIPLE_SUBMISSION_WARNING
354+ )
355+
356+ def test_not_multiple_submit_warning3_octave (self ):
357+ markdown = markdowns .OCTAVE_CODE_MARKDWON_NOT_EXPLICITLY_NOT_ALLOW_MULTI_SUBMIT2
358+ resp = self .get_page_sandbox_preview_response (markdown )
359+ self .assertEqual (resp .status_code , 200 )
360+ self .assertSandboxHasValidPage (resp )
361+ self .assertSandboxWarningTextContain (
362+ resp ,
363+ NOT_ALLOW_MULTIPLE_SUBMISSION_WARNING
364+ )
365+
366+ def test_allow_multiple_submit_octave (self ):
367+ markdown = markdowns .OCTAVE_CODE_MARKDWON
368+ resp = self .get_page_sandbox_preview_response (markdown )
369+ self .assertEqual (resp .status_code , 200 )
370+ self .assertSandboxHasValidPage (resp )
371+ self .assertSandboxWarningTextContain (resp , None )
372+
373+ def test_explicity_not_allow_multiple_submit_octave (self ):
374+ markdown = (
375+ markdowns .OCTAVE_CODE_MARKDWON_PATTERN_EXPLICITLY_NOT_ALLOW_MULTI_SUBMIT
376+ % {"extra_data_file" : "" }
377+ )
378+ resp = self .get_page_sandbox_preview_response (markdown )
379+ self .assertEqual (resp .status_code , 200 )
380+ self .assertSandboxHasValidPage (resp )
381+ self .assertSandboxWarningTextContain (resp , None )
382+
383+ def test_question_without_test_code_octave (self ):
384+ markdown = markdowns .OCTAVE_CODE_MARKDWON_PATTERN_WITHOUT_TEST_CODE
385+ resp = self .get_page_sandbox_preview_response (markdown )
386+ self .assertEqual (resp .status_code , 200 )
387+ self .assertSandboxHasValidPage (resp )
388+ self .assertSandboxWarningTextContain (resp , None )
389+
390+ resp = self .get_page_sandbox_submit_answer_response (
391+ markdown ,
392+ answer_data = {"answer" : ['c = b + a\r ' ]})
393+ self .assertEqual (resp .status_code , 200 )
394+ self .assertResponseContextAnswerFeedbackCorrectnessEquals (resp , None )
395+ self .assertResponseContextAnswerFeedbackContainsFeedback (
396+ resp , NO_CORRECTNESS_INFO_MSG )
397+
398+ def test_question_without_correct_code_octave (self ):
399+ markdown = markdowns .OCTAVE_CODE_MARKDWON_PATTERN_WITHOUT_CORRECT_CODE
400+ resp = self .get_page_sandbox_preview_response (markdown )
401+ self .assertEqual (resp .status_code , 200 )
402+ self .assertSandboxHasValidPage (resp )
403+ self .assertSandboxWarningTextContain (resp , None )
404+
405+ resp = self .get_page_sandbox_submit_answer_response (
406+ markdown ,
407+ answer_data = {"answer" : ['c = b + a\r ' ]})
408+ self .assertEqual (resp .status_code , 200 )
409+ self .assertResponseContextAnswerFeedbackCorrectnessEquals (resp , 1 )
410+
313411 def test_question_with_human_feedback_both_feedback_value_feedback_percentage_present (self ): # noqa
314412 markdown = (markdowns .CODE_WITH_HUMAN_FEEDBACK_MARKDWON_PATTERN
315413 % {"value" : 3 ,
0 commit comments