@@ -0,0 +1,2430 @@
+# Licensed to the StackStorm, Inc ('StackStorm') under one or more%0A# contributor license agreements.  See the NOTICE file distributed with%0A# this work for additional information regarding copyright ownership.%0A# The ASF licenses this file to You under the Apache License, Version 2.0%0A# (the %22License%22); you may not use this file except in compliance with%0A# the License.  You may obtain a copy of the License at%0A#%0A#     http://www.apache.org/licenses/LICENSE-2.0%0A#%0A# Unless required by applicable law or agreed to in writing, software%0A# distributed under the License is distributed on an %22AS IS%22 BASIS,%0A# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A# See the License for the specific language governing permissions and%0A# limitations under the License.%0A%0Aimport tempfile%0A%0Afrom st2common import service_setup%0A%0Afrom st2tests.base import CleanFilesTestCase%0Afrom st2tests import config%0A%0A__all__ = %5B%0A    'ServiceSetupTestCase'%0A%5D%0A%0AMOCK_LOGGING_CONFIG_INVALID_LOG_LEVEL = %22%22%22%0A%5Bloggers%5D%0Akeys=root%0A%0A%5Bhandlers%5D%0Akeys=consoleHandler%0A%0A%5Bformatters%5D%0Akeys=simpleConsoleFormatter%0A%0A%5Blogger_root%5D%0Alevel=invalid_log_level%0Ahandlers=consoleHandler%0A%0A%5Bhandler_consoleHandler%5D%0Aclass=StreamHandler%0Alevel=DEBUG%0Aformatter=simpleConsoleFormatter%0Aargs=(sys.stdout,)%0A%0A%5Bformatter_simpleConsoleFormatter%5D%0Aclass=st2common.logging.formatters.ConsoleLogFormatter%0Aformat=%25(asctime)s %25(levelname)s %5B-%5D %25(message)s%0Adatefmt=%0A%22%22%22.strip()%0A%0A%0Aclass ServiceSetupTestCase(CleanFilesTestCase):%0A    def test_invalid_log_level_friendly_error_message(self):%0A%0A        _, mock_logging_config_path = tempfile.mkstemp()%0A        self.to_delete_files.append(mock_logging_config_path)%0A%0A        with open(mock_logging_config_path, 'w') as fp:%0A            fp.write(MOCK_LOGGING_CONFIG_INVALID_LOG_LEVEL)%0A%0A        def mock_get_logging_config_path():%0A            return mock_logging_config_path%0A%0A        config.get_logging_config_path = mock_get_logging_config_path%0A%0A        expected_msg = 'Invalid log level selected. Log level names need to be all uppercase'%0A        self.assertRaisesRegexp(KeyError, expected_msg, service_setup.setup, service='api',%0A                                config=config,%0A                                setup_db=False, register_mq_exchanges=False,%0A                                register_signal_handlers=False,%0A                                register_internal_trigger_types=False,%0A                                run_migrations=False)%0A

Add a test case for invalid log level friendly error message during service setup.