From 472ca450f244b8e4e59bf5bd2fd327caa576bce1 Mon Sep 17 00:00:00 2001 From: Ricky White Date: Fri, 26 Jul 2024 11:13:21 -0400 Subject: [PATCH] Formatting commit --- .../storage_secure_os.py | 1 - sdk/python/storage/tests/mock_secure_exec.py | 2 +- .../storage/tests/storage_secure_os_test.py | 25 +++++++++++-------- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/sdk/python/storage/keeper_secrets_manager_storage/storage_secure_os.py b/sdk/python/storage/keeper_secrets_manager_storage/storage_secure_os.py index dca04091..81e293fd 100644 --- a/sdk/python/storage/keeper_secrets_manager_storage/storage_secure_os.py +++ b/sdk/python/storage/keeper_secrets_manager_storage/storage_secure_os.py @@ -78,7 +78,6 @@ def read_storage(self) -> dict: config = json_to_dict(base64_to_string(result)) for key in config: self.config[ConfigKeys.get_enum(key)] = config[key] - return self.config def save_storage(self) -> None: diff --git a/sdk/python/storage/tests/mock_secure_exec.py b/sdk/python/storage/tests/mock_secure_exec.py index 5d16aa08..2a849ef5 100644 --- a/sdk/python/storage/tests/mock_secure_exec.py +++ b/sdk/python/storage/tests/mock_secure_exec.py @@ -6,7 +6,7 @@ # |_| # # Keeper Secrets Manager -# Copyright 2023 Keeper Security Inc. +# Copyright 2024 Keeper Security Inc. # Contact: sm@keepersecurity.com import sys diff --git a/sdk/python/storage/tests/storage_secure_os_test.py b/sdk/python/storage/tests/storage_secure_os_test.py index 0c3eeec0..28bcfb3b 100644 --- a/sdk/python/storage/tests/storage_secure_os_test.py +++ b/sdk/python/storage/tests/storage_secure_os_test.py @@ -12,9 +12,11 @@ def setUp(self): self.orig_working_dir = os.getcwd() # Create mock secure storage executable - self.mock_exec_path = os.path.join(self.orig_working_dir, "keeper_secrets_manager_core", "mock_secure_exec.py") - - # sys.executable returns the path of the current python interpreter + self.mock_exec_path = os.path.join( + self.orig_working_dir, "tests", "mock_secure_exec.py" + ) + + # sys.executable returns the path of the current python interpreter # which is used to run the mock_secure_exec.py file self.python_interpreter = sys.executable @@ -29,9 +31,13 @@ def test_secure_os_storage(self): storage.set(ConfigKeys.KEY_CLIENT_ID, mock_config.get("clientId")) storage.set(ConfigKeys.KEY_APP_KEY, mock_config.get("appKey")) storage.set(ConfigKeys.KEY_PRIVATE_KEY, mock_config.get("privateKey")) - self.assertEqual(mock_config.get("clientId"), storage.get(ConfigKeys.KEY_CLIENT_ID)) + self.assertEqual( + mock_config.get("clientId"), storage.get(ConfigKeys.KEY_CLIENT_ID) + ) self.assertEqual(mock_config.get("appKey"), storage.get(ConfigKeys.KEY_APP_KEY)) - self.assertEqual(mock_config.get("privateKey"), storage.get(ConfigKeys.KEY_PRIVATE_KEY)) + self.assertEqual( + mock_config.get("privateKey"), storage.get(ConfigKeys.KEY_PRIVATE_KEY) + ) # test contains() self.assertTrue(storage.contains(ConfigKeys.KEY_CLIENT_ID)) @@ -46,8 +52,7 @@ def test_secure_os_storage(self): def test_secure_os_storage_read_storage(self): storage = SecureOSStorage( - app_name="TEST", - exec_path=[self.python_interpreter, self.mock_exec_path] + app_name="TEST", exec_path=[self.python_interpreter, self.mock_exec_path] ) storage.read_storage() @@ -55,11 +60,9 @@ def test_secure_os_storage_read_storage(self): def test_secure_os_storage_save_storage(self): storage = SecureOSStorage( - app_name="TEST", - exec_path=[self.python_interpreter, self.mock_exec_path] + app_name="TEST", exec_path=[self.python_interpreter, self.mock_exec_path] ) storage.config = MockConfig.make_config() - + # Test save_storage() doesn't raise an exception storage.save_storage() - \ No newline at end of file