def test_config_show_fail(self, mock_file_exists, mock_warn, mock_abort): mock_file_exists.return_value = False env.host = "any_host" configure_cmds.configuration_show("any_path") file_path = os.path.join(constants.REMOTE_CONF_DIR, "any_path") mock_warn.assert_called_with("No configuration file found " "for %s at %s" % (env.host, file_path)) configure_cmds.show("invalid_config") mock_abort.assert_called_with("Invalid Argument. Possible values: " "node, jvm, config, log")
def test_config_show(self, mock_file_exists, mock_get): mock_file_exists.return_value = True configure_cmds.show("Node") file_path_node = os.path.join(constants.REMOTE_CONF_DIR, "node.properties") args, kwargs = mock_get.call_args self.assertEqual(args[0], file_path_node) configure_cmds.show("jvm") file_path_jvm = os.path.join(constants.REMOTE_CONF_DIR, "jvm.config") args, kwargs = mock_get.call_args self.assertEqual(args[0], file_path_jvm) configure_cmds.show("conFig") file_path_config = os.path.join(constants.REMOTE_CONF_DIR, "config.properties") args, kwargs = mock_get.call_args self.assertEqual(args[0], file_path_config)
def test_config_show_all(self, mock_show): configure_cmds.show() mock_show.assert_any_call("node.properties") mock_show.assert_any_call("jvm.config") mock_show.assert_any_call("config.properties") mock_show.assert_any_call("log.properties", should_warn=False)