def test_deprecated_validator(self, mock_log_warning): my_deprecated_validator = validation.deprecated_validator( "new_validator", "deprecated_validator", "0.10.0") self.Plugin = my_deprecated_validator("foo", bar="baz")(self.Plugin) self.assertEqual([("new_validator", ("foo",), {"bar": "baz"})], self.Plugin._meta_get("validators")) mock_log_warning.assert_called_once_with(mock.ANY)
def test_deprecated_validator(self, mock_log_warning): my_deprecated_validator = validation.deprecated_validator( "new_validator", "deprecated_validator", "0.10.0") self.Plugin = my_deprecated_validator("foo", bar="baz")(self.Plugin) self.assertEqual([("new_validator", ("foo", ), { "bar": "baz" })], self.Plugin._meta_get("validators")) mock_log_warning.assert_called_once_with(mock.ANY)
def test_deprecated_validator(self, mock_log_warning): my_deprecated_validator = validation.deprecated_validator( "new_validator", "deprecated_validator", "0.10.0") self.Plugin = my_deprecated_validator("foo", bar="baz")(self.Plugin) self.assertEqual([("new_validator", ("foo",), {"bar": "baz"})], self.Plugin._meta_get("validators")) mock_log_warning.assert_called_once_with( "Plugin '%s' uses validator 'rally.task.validation.%s' which is " "deprecated in favor of '%s' (it should be used via new decorator " "'rally.common.validation.add') in Rally v%s.", self.Plugin.get_name(), "deprecated_validator", "new_validator", "0.10.0")
def test_deprecated_validator(self, mock_log_warning): @plugin.from_func() def my_plugin(): pass my_plugin._meta_init() my_plugin._meta_set("name", "my_plugin") my_deprecated_validator = validation.deprecated_validator( "new_validator", "deprecated_validator", "0.10.0") my_plugin = my_deprecated_validator("foo", bar="baz")(my_plugin) self.assertEqual([("new_validator", ("foo",), {"bar": "baz"})], my_plugin._meta_get("validators")) mock_log_warning.assert_called_once_with( "Plugin '%s' uses validator '%s'. " "That validator is deprecated in favor of '%s' in Rally v%s.", "my_plugin", "deprecated_validator", "new_validator", "0.10.0")
def test_deprecated_validator(self, mock_log_warning): @plugin.from_func() def my_plugin(): pass my_plugin._meta_init() my_plugin._meta_set("name", "my_plugin") my_deprecated_validator = validation.deprecated_validator( "new_validator", "deprecated_validator", "0.10.0") my_plugin = my_deprecated_validator("foo", bar="baz")(my_plugin) self.assertEqual([("new_validator", ("foo",), {"bar": "baz"})], my_plugin._meta_get("validators")) mock_log_warning.assert_called_once_with( "Plugin '%s' uses validator 'rally.task.validation.%s' which is " "deprecated in favor of '%s' (it should be used via new decorator " "'rally.common.validation.add') in Rally v%s.", "my_plugin", "deprecated_validator", "new_validator", "0.10.0")