Merge "Add cluster to cert commands"

This commit is contained in:
Jenkins 2016-08-25 01:04:25 +00:00 committed by Gerrit Code Review
commit b978b3c415
3 changed files with 14 additions and 14 deletions

View File

@ -20,25 +20,25 @@ class CertClient(client.MagnumClient):
url = "/certificates" url = "/certificates"
@classmethod @classmethod
def cert_uri(cls, bay_id): def cert_uri(cls, cluster_id):
"""Construct bay uri """Construct cluster uri
:param bay_id: bay uuid or name :param cluster_id: cluster uuid or name
:returns: url string :returns: url string
""" """
return "{0}/{1}".format(cls.url, bay_id) return "{0}/{1}".format(cls.url, cluster_id)
def get_cert(self, bay_id, **kwargs): def get_cert(self, cluster_id, **kwargs):
"""Makes GET /certificates/bay_id request and returns CertEntity """Makes GET /certificates/cluster_id request and returns CertEntity
Abstracts REST call to return a single cert based on uuid or name Abstracts REST call to return a single cert based on uuid or name
:param bay_id: bay uuid or name :param cluster_id: cluster uuid or name
:returns: response object and BayCollection object :returns: response object and ClusterCollection object
""" """
resp, body = self.get(self.cert_uri(bay_id)) resp, body = self.get(self.cert_uri(cluster_id))
return self.deserialize(resp, body, cert_model.CertEntity) return self.deserialize(resp, body, cert_model.CertEntity)
def post_cert(self, model, **kwargs): def post_cert(self, model, **kwargs):

View File

@ -182,7 +182,7 @@ Q0uA0aVog3f5iJxCa3Hp5gxbJQ6zV6kJ0TEsuaaOhEko9sdpCoPOnRBm2i/XRD2D
resp, cert_model = self.cert_client.post_cert(cert_data_model) resp, cert_model = self.cert_client.post_cert(cert_data_model)
self.LOG.debug("cert resp: %s" % resp) self.LOG.debug("cert resp: %s" % resp)
self.assertEqual(201, resp.status) self.assertEqual(201, resp.status)
self.assertEqual(cert_model.bay_uuid, cluster_model.uuid) self.assertEqual(cert_model.cluster_uuid, cluster_model.uuid)
self.assertIsNotNone(cert_model.pem) self.assertIsNotNone(cert_model.pem)
self.assertIn('-----BEGIN CERTIFICATE-----', cert_model.pem) self.assertIn('-----BEGIN CERTIFICATE-----', cert_model.pem)
self.assertIn('-----END CERTIFICATE-----', cert_model.pem) self.assertIn('-----END CERTIFICATE-----', cert_model.pem)

View File

@ -322,11 +322,11 @@ def bay_node_count_patch_data(node_count=2):
return baypatch_model.BayPatchCollection.from_dict(data) return baypatch_model.BayPatchCollection.from_dict(data)
def cert_data(bay_uuid, csr_data): def cert_data(cluster_uuid, csr_data):
data = { data = {
"bay_uuid": bay_uuid, "cluster_uuid": cluster_uuid,
"csr": csr_data, "csr": csr_data}
}
model = cert_model.CertEntity.from_dict(data) model = cert_model.CertEntity.from_dict(data)
return model return model