def test_get_value_fails_validation(self): expected = [self.name, self.config_key] validator = mock.Mock(side_effect=validation.ValidationError) _ = proxy.ValueProxy( # flake8: noqa validator, self.namespace, 'something.broken') assert_raises_and_contains(errors.ConfigurationError, expected, lambda: self.value_proxy.value)
def test_validate_regex_failed(self): pattern = "((this) regex is broken" assert_raises_and_contains( errors.ValidationError, pattern, validation.validate_regex, pattern)
def test_get_value_fails_validation(self): expected = [self.name, self.config_key] validator = mock.Mock(side_effect=validation.ValidationError) _ = proxy.ValueProxy( # noqa: F841 validator, self.namespace, 'something.broken') assert_raises_and_contains( errors.ConfigurationError, expected, lambda: self.value_proxy.value)
def test_validate_regex_none(self): assert_raises_and_contains( errors.ValidationError, 'None', validation.validate_regex, None)
def test_invalid_log_level(self): assert_raises_and_contains( errors.ValidationError, 'UNKNOWN', validation.validate_log_level, 'UNKNOWN')
def test_build_list_of_type_not_a_list(self): validator = validation.build_list_type_validator( validation.validate_any) assert_raises_and_contains( errors.ValidationError, 'Invalid iterable', validator, None)
def test_build_list_of_type_float_failed(self): validator = validation.build_list_type_validator( validation.validate_float) assert_raises_and_contains( errors.ValidationError, 'Invalid float: a', validator, ['0.1', 'a'])
def test_build_list_of_type_float_failed(self): validator = validation.build_list_type_validator( validation.validate_float) assert_raises_and_contains(errors.ValidationError, 'Invalid float: a', validator, ['0.1', 'a'])
def test_validate_regex_none(self): assert_raises_and_contains(errors.ValidationError, 'None', validation.validate_regex, None)
def test_validate_regex_failed(self): pattern = "((this) regex is broken" assert_raises_and_contains(errors.ValidationError, pattern, validation.validate_regex, pattern)
def test_invalid_log_level(self): assert_raises_and_contains(errors.ValidationError, 'UNKNOWN', validation.validate_log_level, 'UNKNOWN')
def test_build_list_of_type_not_a_list(self): validator = validation.build_list_type_validator( validation.validate_any) assert_raises_and_contains(errors.ValidationError, 'Invalid iterable', validator, None)
def test_extract_value_unset(self): expected = [self.name, self.config_key] assert_raises_and_contains(errors.ConfigurationError, expected, lambda: self.value_proxy.value)
def test_extract_value_unset(self): expected = [self.name, self.config_key] assert_raises_and_contains( errors.ConfigurationError, expected, lambda: self.value_proxy.value)