Esempio n. 1
0
 def __validate_fields(self):
     validate_parameter_exists(self.start, "result", "start")
     validate_type(self.start, "start", int)
     validate_parameter_exists(self.end, "result", "end")
     validate_type(self.end, "end", int)
     validate_parameter_not_empty(self.entity_type, "result", "entity_type")
     if self.start < 0 or self.end < 0:
         raise InvalidParamException(
             "Invalid input, result start and end must be positive")
     if self.start >= self.end:
         raise InvalidParamException(
             f"Invalid input, start index '{self.start}' "
             f"must be smaller than end index '{self.end}'")
Esempio n. 2
0
def test_given_parameter_is_0_then_exception_raised():
    with pytest.raises(
            InvalidParamException,
            match="Invalid input, entity must contain name",
    ):
        validate_parameter_not_empty(0, "entity", "name")
Esempio n. 3
0
def test_given_existing_parameter_then_no_exception_raised():
    validate_parameter_not_empty("1234", "entity", "name")
Esempio n. 4
0
 def __validate_fields(self):
     validate_parameter_not_empty(self.operator_name, "operator config",
                                  "operator_name")