Skip to content

Commit

Permalink
Formatting commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Ricky White committed Jul 26, 2024
1 parent 4efbff7 commit 472ca45
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion sdk/python/storage/tests/mock_secure_exec.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# |_|
#
# Keeper Secrets Manager
# Copyright 2023 Keeper Security Inc.
# Copyright 2024 Keeper Security Inc.
# Contact: [email protected]

import sys
Expand Down
25 changes: 14 additions & 11 deletions sdk/python/storage/tests/storage_secure_os_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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))
Expand All @@ -46,20 +52,17 @@ 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()
self.assertIsNotNone(storage.get(ConfigKeys.KEY_CLIENT_ID))

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()

0 comments on commit 472ca45

Please sign in to comment.