From 10439aa2460324e954aa709fa6d078626bf002a8 Mon Sep 17 00:00:00 2001 From: KOSASIH Date: Wed, 18 Sep 2024 10:54:31 +0700 Subject: [PATCH] Create test_secrets_manager.py --- app/tests/test_secrets_manager.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 app/tests/test_secrets_manager.py diff --git a/app/tests/test_secrets_manager.py b/app/tests/test_secrets_manager.py new file mode 100644 index 000000000..2be69a8b3 --- /dev/null +++ b/app/tests/test_secrets_manager.py @@ -0,0 +1,23 @@ +import unittest +from app.secrets_manager import SecretsManager +import os + +class TestSecretsManager(unittest.TestCase): + def setUp(self): + self.secrets_file = 'secrets.json' + self.secrets_manager = SecretsManager(self.secrets_file) + + def test_get_secret(self): + self.secrets_manager.set_secret('mysecret', 'myvalue') + self.assertEqual(self.secrets_manager.get_secret('mysecret'), 'myvalue') + + def test_set_secret(self): + self.secrets_manager.set_secret('mysecret', 'myvalue') + self.assertEqual(self.secrets_manager.get_secret('mysecret'), 'myvalue') + + def tearDown(self): + if os.path.exists(self.secrets_file): + os.remove(self.secrets_file) + +if __name__ == '__main__': + unittest.main()