Esempio n. 1
0
 def test_get_missing_host_cert(self):
     """Retrieve a missing host cert" return an empty results object."""
     cn = 'test.get-missing-foo.com'
     cert = SpokeHostCert(cn, self.ca_name)
     expected_result = {'count': 0, 'type': 'Certificate', 'data': [], 'exit_code': 3,
                        'msg': 'No Certificate(s) found'}
     result = cert.get()
     self.assertEqual(result, expected_result)
Esempio n. 2
0
 def test_get_missing_host_cert(self):
     """Retrieve a missing host cert" return an empty results object."""
     cn = 'test.get-missing-foo.com'
     cert = SpokeHostCert(cn, self.ca_name)
     expected_result = {
         'count': 0,
         'type': 'Certificate',
         'data': [],
         'exit_code': 3,
         'msg': 'No Certificate(s) found'
     }
     result = cert.get()
     self.assertEqual(result, expected_result)
Esempio n. 3
0
 def test_get_host_cert(self):
     """Retrieve a host cert; return a results object."""
     cn = 'test.get.foo.com'
     cert = SpokeHostCert(cn, self.ca_name)
     expected_result = {'count': 1, 'type': 'Certificate', 'exit_code': 0, 
                        'msg': 'Found Certificate:'}
     expected_result['data'] = [{'cert_cn': cn,
                         'verify': 'success',
                         'cert_as_pem': ''}]
     cert.create()
     result = cert.get()
     result['data'][0]['cert_as_pem'] = ''
     self.assertEqual(result, expected_result)
     cert.delete()
Esempio n. 4
0
 def test_get_host_cert(self):
     """Retrieve a host cert; return a results object."""
     cn = 'test.get.foo.com'
     cert = SpokeHostCert(cn, self.ca_name)
     expected_result = {
         'count': 1,
         'type': 'Certificate',
         'exit_code': 0,
         'msg': 'Found Certificate:'
     }
     expected_result['data'] = [{
         'cert_cn': cn,
         'verify': 'success',
         'cert_as_pem': ''
     }]
     cert.create()
     result = cert.get()
     result['data'][0]['cert_as_pem'] = ''
     self.assertEqual(result, expected_result)
     cert.delete()