Skip to content

Instantly share code, notes, and snippets.

@naturalett
Created May 4, 2020 15:08
Show Gist options
  • Save naturalett/136b6d4b0c677672cdd66d3c72c7d107 to your computer and use it in GitHub Desktop.
Save naturalett/136b6d4b0c677672cdd66d3c72c7d107 to your computer and use it in GitHub Desktop.
SecretManagerTest
'''Example code of the SecretManagerTest class'''
import unittest, os.path
from os.path import dirname, abspath
import SecretManager
class SecretManagerTest(unittest.TestCase):
SERVICE_NAME = "helloWorld"
ENVIRONMENT = "test"
FILEPATH = os.path.join(dirname(dirname(abspath(os.path.dirname( __file__ )))), 'ssm.json')
credentialName1 = "mysql-user"
credentialName2 = "mysql-pass"
conn = SecretManager(SERVICE_NAME, ENVIRONMENT, FILEPATH)
conn.initialize([credentialName1, credentialName2])
def test_getSingleParameter(self):
credentials = self.conn.getCredentials([self.credentialName1])
self.assertTrue(credentials)
self.assertEqual(len(credentials), 1)
self.assertTrue(credentials.get(self.credentialName1))
def test_getMultipleParameters(self):
# TBD
assert True
def test_getMultipleParametersWithOneInvalid(self):
# TBD
assert True
def test_incorrectInit(self):
# TBD
assert True
def test_wrongFilepath(self):
# TBD
assert True
if __name__ == '__main__':
import xmlrunner
unittest.main(
testRunner=xmlrunner.XMLTestRunner(output='test-reports'),
failfast=False,
buffer=False,
catchbreak=False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment