Beispiel #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))
Beispiel #2
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)
Beispiel #3
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))
Beispiel #4
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)
Beispiel #5
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)
Beispiel #6
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)
Beispiel #7
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)
Beispiel #8
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)
Beispiel #9
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)
Beispiel #10
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)