def test_read_config_does_not_crash_on_unreadable_config(self): test_config_path = os.path.join(self.test_config_directory.name, 'test_config.json') test_config = open(test_config_path, mode='w+') with mock.patch.dict('os.environ', {'REMEHA_CONF': test_config.name}): test_config.write( '{ "database_logger": { "host": "testserver.local", "user_name": "database_user", "password": "******" } ' ) test_config.close() config = read_config() assert config is None
def test_read_default_config_if_REMEHA_CONF_not_set(self): with mock.patch.dict('os.environ', clear=True): config = read_config() assert config is not None