summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDileep Ranganathan <dileep.ranganathan@intel.com>2018-09-27 08:06:26 -0700
committerDileep Ranganathan <dileep.ranganathan@intel.com>2018-10-08 03:21:43 -0700
commitfa9960690db89b0695c266abdb9009e2331f6f3c (patch)
treeba2946805cc2b6e9c8b31767909002e15b371743 /test
parent9d5af7d79a3c32099da70c512d35fa2662812b7a (diff)
Retrieve secrets using Secret Management Service
Integrate with OSDF by retrieving stored secrets using SMS Application code remains in tact as the secrets are preloaded and stored in config. The configs in clear text will be deprecated eventually. OOM needs to load aaf-sms and preload secrets before oof deployment. Updated to use domain name instead of domain uuid. Change-Id: I88a3c3dd2ad87753cc056fb63c8bbabd546707ab Issue-ID: OPTFRA-343 Signed-off-by: Dileep Ranganathan <dileep.ranganathan@intel.com>
Diffstat (limited to 'test')
-rw-r--r--test/adapters/test_sms.py16
1 files changed, 5 insertions, 11 deletions
diff --git a/test/adapters/test_sms.py b/test/adapters/test_sms.py
index ed6c9c9..ae9346d 100644
--- a/test/adapters/test_sms.py
+++ b/test/adapters/test_sms.py
@@ -35,10 +35,7 @@ class TestSMS(unittest.TestCase):
@requests_mock.mock()
def test_sms(self, mock_sms):
- ''' NOTE: preload_secret generate the uuid for the domain
- Create Domain API is called during the deployment using a
- preload script. So the application oly knows the domain_uuid.
- All sub-sequent SMS API calls needs the uuid.
+ ''' NOTE: preload_secret during the deployment using a preload script.
For test purposes we need to do preload ourselves'''
sms_url = self.config["aaf_sms_url"]
@@ -53,7 +50,8 @@ class TestSMS(unittest.TestCase):
# Mock requests for preload_secret
cd_url = self.base_domain_url.format(sms_url)
domain_uuid1 = str(uuid4())
- s_url = self.secret_url.format(sms_url, domain_uuid1)
+ domain_name = self.config['secret_domain']
+ s_url = self.secret_url.format(sms_url, domain_name)
mock_sms.post(cd_url, status_code=200, json={'uuid': domain_uuid1})
mock_sms.post(s_url, status_code=200)
# Initialize Secrets from SMS
@@ -61,13 +59,9 @@ class TestSMS(unittest.TestCase):
# Part 2: Retrieve Secret Test
# Mock requests for retrieve_secrets
- # IMPORTANT: Read the config again as the preload_secrets has
- # updated the config with uuid
- domain_uuid2 = self.config["secret_domain"]
- self.assertEqual(domain_uuid1, domain_uuid2)
- d_url = self.domain_url.format(sms_url, domain_uuid2)
- s_url = self.secret_url.format(sms_url, domain_uuid2)
+ d_url = self.domain_url.format(sms_url, domain_name)
+ s_url = self.secret_url.format(sms_url, domain_name)
# Retrieve Secrets from SMS and load to secret cache
# Use the secret_cache instead of config files