예제 #1
0
 def testShouldGiveGivenPoints(self):
     myAjaxExercisePage = MyAjaxExerciseGrader(self.driver)
     myAjaxExercisePage.setText("50")
     myAjaxExercisePage.submit()
     self.assertEqual(myAjaxExercisePage.getAllowedSubmissions(), '1 / 10')
     self.assertEqual(myAjaxExercisePage.getExerciseScore(), '50 / 100')
     self.assertEqual(myAjaxExercisePage.getNumberOfSubmitters(), '1')
예제 #2
0
    def testShouldGiveZeroPointsOnOverTheLimitSubmit(self):
        myAjaxExercisePage = MyAjaxExerciseGrader(self.driver)
        myAjaxExercisePage.setText("101")
        myAjaxExercisePage.submit()

        # Over the limit leaves submission to error state and does not count.
        self.assertEqual(myAjaxExercisePage.getAllowedSubmissions(), '0 / 10')
        self.assertEqual(myAjaxExercisePage.getExerciseScore(), '0 / 100')
        self.assertEqual(myAjaxExercisePage.getNumberOfSubmitters(), '1')
 def testShouldGiveGivenPoints(self):
     myAjaxExercisePage = MyAjaxExerciseGrader(self.driver)
     myAjaxExercisePage.setText("50")
     myAjaxExercisePage.submit()
     self.assertEqual(myAjaxExercisePage.getAllowedSubmissions(), '1 / 10')
     self.assertEqual(myAjaxExercisePage.getExerciseScore(), '50 / 100')
     self.assertEqual(myAjaxExercisePage.getNumberOfSubmitters(), '1')
    def testShouldGiveZeroPointsOnOverTheLimitSubmit(self):
        myAjaxExercisePage = MyAjaxExerciseGrader(self.driver)
        myAjaxExercisePage.setText("101")
        myAjaxExercisePage.submit()

        # Over the limit leaves submission to error state and does not count.
        self.assertEqual(myAjaxExercisePage.getAllowedSubmissions(), '0 / 10')
        self.assertEqual(myAjaxExercisePage.getExerciseScore(), '0 / 100')
        self.assertEqual(myAjaxExercisePage.getNumberOfSubmitters(), '1')
 def testShouldGiveZeroPointsOnEmptySubmit(self):
     myAjaxExercisePage = MyAjaxExerciseGrader(self.driver)
     myAjaxExercisePage.submit()
     self.assertEqual(myAjaxExercisePage.getAllowedSubmissions(), '1 / 10')
     self.assertEqual(myAjaxExercisePage.getExerciseScore(), '0 / 100')
     self.assertEqual(myAjaxExercisePage.getNumberOfSubmitters(), '1')
예제 #6
0
    def testShouldContainAsManySubmissionsAsSubmitted(self):
        firstExercisePage = MyFirstExerciseGrader(self.driver)
        firstExercisePage.setText("123test")
        firstExercisePage.submit()
        self.assertEqual(
            SubmissionPage(self.driver, exerciseId="1").getSubmissionCount(),
            1)

        firstExercisePage = MyFirstExerciseGrader(self.driver)
        firstExercisePage.setText("Hello")
        firstExercisePage.submit()
        self.assertEqual(
            SubmissionPage(self.driver, exerciseId="1").getSubmissionCount(),
            2)

        ajaxExercisePage = MyAjaxExerciseGrader(self.driver)
        ajaxExercisePage.setText(-1)
        ajaxExercisePage.submit()
        self.assertEqual(
            SubmissionPage(self.driver, exerciseId="3").getSubmissionCount(),
            1)

        ajaxExercisePage = MyAjaxExerciseGrader(self.driver)
        ajaxExercisePage.setText(50)
        ajaxExercisePage.submit()
        self.assertEqual(
            SubmissionPage(self.driver, exerciseId="3").getSubmissionCount(),
            2)

        firstExercisePage = MyFirstExerciseGrader(self.driver)
        firstExercisePage.setText("HelloA+")
        firstExercisePage.submit()
        self.assertEqual(
            SubmissionPage(self.driver, exerciseId="1").getSubmissionCount(),
            3)

        ajaxExercisePage = MyAjaxExerciseGrader(self.driver)
        ajaxExercisePage.setText(100)
        ajaxExercisePage.submit()
        self.assertEqual(
            SubmissionPage(self.driver, exerciseId="3").getSubmissionCount(),
            3)
예제 #7
0
 def testShouldGiveZeroPointsOnEmptySubmit(self):
     myAjaxExercisePage = MyAjaxExerciseGrader(self.driver)
     myAjaxExercisePage.submit()
     self.assertEqual(myAjaxExercisePage.getAllowedSubmissions(), '1 / 10')
     self.assertEqual(myAjaxExercisePage.getExerciseScore(), '0 / 100')
     self.assertEqual(myAjaxExercisePage.getNumberOfSubmitters(), '1')
예제 #8
0
    def testShouldContainAsManySubmissionsAsSubmitted(self):
        firstExercisePage = MyFirstExerciseGrader(self.driver)
        firstExercisePage.setText("123test")
        firstExercisePage.submit()
        self.assertEqual(SubmissionPage(self.driver, exerciseId="1").getSubmissionCount(), 1)

        firstExercisePage = MyFirstExerciseGrader(self.driver)
        firstExercisePage.setText("Hello")
        firstExercisePage.submit()
        self.assertEqual(SubmissionPage(self.driver, exerciseId="1").getSubmissionCount(), 2)

        ajaxExercisePage = MyAjaxExerciseGrader(self.driver)
        ajaxExercisePage.setText(-1)
        ajaxExercisePage.submit()
        self.assertEqual(SubmissionPage(self.driver, exerciseId="3").getSubmissionCount(), 1)

        ajaxExercisePage = MyAjaxExerciseGrader(self.driver)
        ajaxExercisePage.setText(50)
        ajaxExercisePage.submit()
        self.assertEqual(SubmissionPage(self.driver, exerciseId="3").getSubmissionCount(), 2)

        firstExercisePage = MyFirstExerciseGrader(self.driver)
        firstExercisePage.setText("HelloA+")
        firstExercisePage.submit()
        self.assertEqual(SubmissionPage(self.driver, exerciseId="1").getSubmissionCount(), 3)

        ajaxExercisePage = MyAjaxExerciseGrader(self.driver)
        ajaxExercisePage.setText(100)
        ajaxExercisePage.submit()
        self.assertEqual(SubmissionPage(self.driver, exerciseId="3").getSubmissionCount(), 3)