Exemplo n.º 1
0
def test_given_parameter_in_range_then_we_pass():
    validate_parameter_in_range(
        values_range=["1", "2"],
        parameter_value="1",
        parameter_name="name",
        parameter_type=str,
    )
Exemplo n.º 2
0
 def validate(self, params: Dict = None) -> None:
     """Validate the hash type is string and in range of allowed hash types."""
     validate_parameter_in_range(
         [self.SHA256, self.SHA512, self.MD5],
         self._get_hash_type_or_default(params),
         self.HASH_TYPE,
         str,
     )
     pass
Exemplo n.º 3
0
def test_when_parameter_not_in_range_then_ipe_raised():
    with pytest.raises(
        InvalidParamException,
        match="Parameter name value 1 is not in range of values \\['0', '2'\\]",
    ):
        validate_parameter_in_range(
            values_range=["0", "2"],
            parameter_value="1",
            parameter_name="name",
            parameter_type=str,
        )