Exemplo n.º 1
0
 def test_delete_ca_csr_files(self):
     """Delete a CA CSR; return True."""
     ca_cn = 'Test Delete CA CSR'
     csr = SpokeCSR(ca_cn, self.ca_name, ca=True)
     csr.create()
     csr.delete(delete_key=True)
     self.assertFalse(os.path.exists(csr.req_file))
Exemplo n.º 2
0
 def test_create_host_csr_files(self):
     """Create a host CSR; verify req file created; return True."""
     cn = 'test.host.csr.file'
     csr = SpokeCSR(cn, self.ca_name)
     csr.create()
     self.assertTrue(os.path.exists(csr.req_file))
     csr.delete(delete_key=True)
Exemplo n.º 3
0
 def test_get_a_missing_csr(self):
     """Retrieve a missing CSR; return empty results object."""
     cn = 'missing.foo.com'
     csr = SpokeCSR(cn, self.ca_name)
     result = csr.get()
     expected_result = {'count': 0, 'type': 'Request', 'data': [], 'exit_code': 3,
                        'msg': 'No Request(s) found'}
     self.assertEqual(result, expected_result)
Exemplo n.º 4
0
 def test_delete_ca_csr(self):
     """Delete a CA CSR; return True."""
     ca_cn = 'Test Delete CA CSR'
     csr = SpokeCSR(ca_cn, self.ca_name, ca=True)
     csr.create()
     result = csr.delete(delete_key=True)
     expected_result = {'count': 0, 'type': 'Request', 'data': [], 'exit_code': 3,
                        'msg': 'Deleted Request:'}
     self.assertEqual(result, expected_result)
Exemplo n.º 5
0
 def test_create_host_csr(self):
     """Create a host CSR; return result object."""
     cn = 'test.host.csr'
     expected_result = {'count': 1, 'type': 'Request', 'exit_code': 0, 
                        'msg': 'Found Request:'}
     expected_result['data'] = [{'req_cn': cn,
                         'verify': 'success',
                         'req_as_pem': ''}]
     csr = SpokeCSR(cn, self.ca_name)
     result = csr.create()
     result['data'][0]['req_as_pem'] = ''
     self.assertEqual(result, expected_result)
     csr.delete(delete_key=True)
Exemplo n.º 6
0
 def test_create_host_csr(self):
     """Create a host CSR; return result object."""
     cn = 'test.host.csr'
     expected_result = {
         'count': 1,
         'type': 'Request',
         'exit_code': 0,
         'msg': 'Found Request:'
     }
     expected_result['data'] = [{
         'req_cn': cn,
         'verify': 'success',
         'req_as_pem': ''
     }]
     csr = SpokeCSR(cn, self.ca_name)
     result = csr.create()
     result['data'][0]['req_as_pem'] = ''
     self.assertEqual(result, expected_result)
     csr.delete(delete_key=True)
Exemplo n.º 7
0
 def test_validate_ca_csr(self):
     """Create a CA CSR; validate CSR; return True."""
     ca_cn = 'test-create-ca-csr'
     csr = SpokeCSR(ca_cn, self.ca_name, ca=True)
     csr.create()
     self.assertTrue(csr._verify())
     csr.delete(delete_key=True)