From 1b04d04aa01b74989cfe1b6d4632cb196f283687 Mon Sep 17 00:00:00 2001 From: Daniel McKnight Date: Wed, 13 Nov 2024 08:50:22 -0800 Subject: [PATCH] Refactor token name to be URL-safe Fix logical error in unit test --- neon_utils/hana_utils.py | 2 +- tests/hana_util_tests.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/neon_utils/hana_utils.py b/neon_utils/hana_utils.py index d2edb345..971b1f05 100644 --- a/neon_utils/hana_utils.py +++ b/neon_utils/hana_utils.py @@ -105,7 +105,7 @@ def _get_token(backend_address: str): hana_config = Configuration().get('hana', {}) username = hana_config.get("username") or "guest" password = hana_config.get("password") or "password" - token_name = f"{gethostname()} {datetime.utcnow().isoformat()}" + token_name = f"{gethostname()}_{datetime.utcnow().isoformat()}" resp = requests.post(f"{backend_address}/auth/login", json={"username": username, "password": password, diff --git a/tests/hana_util_tests.py b/tests/hana_util_tests.py index 73bf883a..8effe5ab 100644 --- a/tests/hana_util_tests.py +++ b/tests/hana_util_tests.py @@ -112,7 +112,7 @@ def test_00_get_token(self, config, config_path): # Test with configured invalid login config.return_value = {"hana": {"username": "guest", - "password": "password"}} + "password": "fake_password"}} from neon_utils.hana_utils import ServerException with self.assertRaises(ServerException): _get_token(self.test_server)