Get all certificates from NSX
client.get method retrieves only the first page of results from NSX. In large
scale environments, we wouldn't return all the Certificates. The patch fixes
this behavior to return all the certificates on NSX
Issue: #3048262
Change-Id: Ic43c28eb93bf706209980f66c97d217bd4c4d611
(cherry picked from commit c9fea99b4f
)
This commit is contained in:
parent
7872277fea
commit
d4ab1da8b4
|
@ -44,7 +44,7 @@ class TestNsxLibTrustManagement(nsxlib_testcase.NsxClientTestCase):
|
|||
|
||||
def test_find_cert_with_pem_empty(self):
|
||||
pem = 'abc'
|
||||
with mock.patch.object(self.nsxlib.client, 'get',
|
||||
with mock.patch.object(self.nsxlib.client, 'list',
|
||||
return_value={'results': []}):
|
||||
results = self.nsxlib.trust_management.find_cert_with_pem(pem)
|
||||
self.assertEqual(0, len(results))
|
||||
|
@ -52,7 +52,7 @@ class TestNsxLibTrustManagement(nsxlib_testcase.NsxClientTestCase):
|
|||
def test_find_cert_with_pem_found(self):
|
||||
pem = consts.FAKE_CERT_PEM
|
||||
with mock.patch.object(
|
||||
self.nsxlib.client, 'get',
|
||||
self.nsxlib.client, 'list',
|
||||
return_value={'results': consts.FAKE_CERT_LIST}):
|
||||
results = self.nsxlib.trust_management.find_cert_with_pem(pem)
|
||||
self.assertEqual(1, len(results))
|
||||
|
@ -60,7 +60,7 @@ class TestNsxLibTrustManagement(nsxlib_testcase.NsxClientTestCase):
|
|||
def test_find_cert_with_pem_rn_found(self):
|
||||
pem = consts.FAKE_CERT_PEM.replace('\n', '\r\n')
|
||||
with mock.patch.object(
|
||||
self.nsxlib.client, 'get',
|
||||
self.nsxlib.client, 'list',
|
||||
return_value={'results': consts.FAKE_CERT_LIST}):
|
||||
results = self.nsxlib.trust_management.find_cert_with_pem(pem)
|
||||
self.assertEqual(1, len(results))
|
||||
|
|
|
@ -60,7 +60,7 @@ class NsxLibTrustManagement(utils.NsxLibApiBase):
|
|||
return self.client.get(resource)
|
||||
|
||||
def get_certs(self):
|
||||
return self.client.get(CERT_SECTION)['results']
|
||||
return self.client.list(CERT_SECTION)['results']
|
||||
|
||||
def delete_cert(self, cert_id):
|
||||
resource = CERT_SECTION + '/' + cert_id
|
||||
|
|
Loading…
Reference in New Issue