gitops/scripts/secret/tests/test_secret.py
2025-05-23 21:19:18 +08:00

30 lines
907 B
Python

import unittest
from hcp import get_hcp_api_token, get_secret_data, get_secret_value_by_name
class TestHCPSecret(unittest.TestCase):
def test_get_hcp_api_token(self):
# Mock the API response and test the token retrieval
pass # Add actual test logic here
def test_get_secret_data(self):
# Mock the API response and test secret data fetching
pass # Add actual test logic here
def test_get_secret_value_by_name(self):
secret_data = {
"secrets": [
{
"name": "cn_gateway_private_key",
"version": {
"value": "test_value"
}
}
]
}
value = get_secret_value_by_name(secret_data, "cn_gateway_private_key")
self.assertEqual(value, "test_value")
if __name__ == "__main__":
unittest.main()