Exemplo n.º 1
0
    def test_enforce_peer_then_self(self, data):
        success, msg = validate_assessments(data['assessments'],
                                            enforce_peer_then_self=True)
        self.assertEqual(success, data['valid'], msg=msg)

        if not success:
            self.assertGreater(len(msg), 0)
Exemplo n.º 2
0
    def _assert_validation(self, assessments, current_assessments, is_released,
                           expected_is_valid):
        """
        Check that the validation function gives the expected result.
        If there is a validation error, check that the validation error message isn't empty.

        Args:
            assessments (list): The updated list of assessments
            current_assessments (list): The current assessments in the problem definition.
            is_released (bool): Whether the problem has been released yet.
            expected_is_valid (bool): Whether the inputs should be marked valid or invalid

        Returns:
            None

        Raises:
            AssertionError

        """
        success, msg = validate_assessments(assessments, current_assessments,
                                            is_released, STUB_I18N)
        self.assertEqual(success, expected_is_valid, msg=msg)

        if not success:
            self.assertGreater(len(msg), 0)
Exemplo n.º 3
0
    def _assert_validation(self, assessments, current_assessments, is_released, expected_is_valid):
        """
        Check that the validation function gives the expected result.
        If there is a validation error, check that the validation error message isn't empty.

        Args:
            assessments (list): The updated list of assessments
            current_assessments (list): The current assessments in the problem definition.
            is_released (bool): Whether the problem has been released yet.
            expected_is_valid (bool): Whether the inputs should be marked valid or invalid

        Returns:
            None

        Raises:
            AssertionError

        """
        success, msg = validate_assessments(assessments, current_assessments, is_released)
        self.assertEqual(success, expected_is_valid, msg=msg)

        if not success:
            self.assertGreater(len(msg), 0)
Exemplo n.º 4
0
 def test_no_assessments(self):
     success, msg = validate_assessments([], [], False, STUB_I18N)
     self.assertFalse(success)
     self.assertGreater(len(msg), 0)
Exemplo n.º 5
0
 def test_invalid_assessment(self, data):
     success, msg = validate_assessments(data["assessments"],
                                         data["current_assessments"],
                                         data["is_released"], STUB_I18N)
     self.assertFalse(success)
     self.assertGreater(len(msg), 0)
Exemplo n.º 6
0
 def test_valid_assessment(self, data):
     success, msg = validate_assessments(data["assessments"],
                                         data["current_assessments"],
                                         data["is_released"], STUB_I18N)
     self.assertTrue(success)
     self.assertEqual(msg, '')
Exemplo n.º 7
0
 def test_no_assessments(self):
     success, msg = validate_assessments([], [], False)
     self.assertFalse(success)
     self.assertGreater(len(msg), 0)
Exemplo n.º 8
0
 def test_invalid_assessment(self, data):
     success, msg = validate_assessments(data["assessments"], data["current_assessments"], data["is_released"])
     self.assertFalse(success)
     self.assertGreater(len(msg), 0)
Exemplo n.º 9
0
 def test_valid_assessment(self, data):
     success, msg = validate_assessments(data["assessments"], data["current_assessments"], data["is_released"])
     self.assertTrue(success)
     self.assertEqual(msg, u'')
Exemplo n.º 10
0
    def test_enforce_peer_then_self(self, data):
        success, msg = validate_assessments(data['assessments'], enforce_peer_then_self=True)
        self.assertEqual(success, data['valid'], msg=msg)

        if not success:
            self.assertGreater(len(msg), 0)
Exemplo n.º 11
0
 def test_invalid_assessment(self, data):
     success, msg = validate_assessments([data['assessment']])
     self.assertFalse(success)
     self.assertGreater(len(msg), 0)
Exemplo n.º 12
0
 def test_valid_assessment(self, data):
     success, msg = validate_assessments([data['assessment']])
     self.assertTrue(success)
     self.assertEqual(msg, u'')
Exemplo n.º 13
0
    def test_enforce_assessment_combo_restrictions(self, data):
        success, msg = validate_assessments(data["assessments"], data["current_assessments"], data["is_released"])
        self.assertEqual(success, data['valid'], msg=msg)

        if not success:
            self.assertGreater(len(msg), 0)
Exemplo n.º 14
0
 def test_invalid_assessment(self, data):
     success, msg = validate_assessments([data['assessment']])
     self.assertFalse(success)
     self.assertGreater(len(msg), 0)
Exemplo n.º 15
0
 def test_valid_assessment(self, data):
     success, msg = validate_assessments([data['assessment']])
     self.assertTrue(success)
     self.assertEqual(msg, u'')