Example #1
0
    def test_when_multiple_valid_length_of_course_returns_no_error(self):
        length_of_course = "1,7"
        validator = Validator("", "", length_of_course, "", "0", 100, "0", "en")

        output_lengths, output_error_object = validator.validate_length_of_course()

        self.assertEqual(["1", "7"], output_lengths)
        self.assertEqual([], output_error_object)
Example #2
0
    def test_when_length_of_course_is_above_minimum_number_of_years_returns_error(self):
        length_of_course = "0"
        validator = Validator("", "", length_of_course, "", "0", 100, "0", "en")

        output_lengths, output_error_object = validator.validate_length_of_course()
        expected_error_object = [
            {
                "error": "length_of_course values needs to be numbers between the range of 1 and 7",
                "error_values": [{"length_of_course": "0"}],
            }
        ]

        self.assertEqual([], output_lengths)
        self.assertEqual(expected_error_object, output_error_object)
Example #3
0
    def test_when_length_of_course_is_not_a_number_returns_error(self):
        length_of_course = "four,3"
        validator = Validator("", "", length_of_course, "", "0", 100, "0", "en")

        output_lengths, output_error_object = validator.validate_length_of_course()
        expected_error_object = [
            {
                "error": "length_of_course values needs to be a number",
                "error_values": [{"length_of_course": "four"}],
            }
        ]

        self.assertEqual([], output_lengths)
        self.assertEqual(expected_error_object, output_error_object)