Commit 9c47ac0f authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_cloud: Change for certificate authority (source_reference to csr_id)

parent a2b2f851
......@@ -61,7 +61,7 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
certificate_login = certificate_login_list[0]
self.assertEqual(certificate_login.getValidationState(), 'validated')
self.assertNotEqual(certificate_login.getReference(), None)
self.assertNotEqual(certificate_login.getSourceReference(), None)
self.assertNotEqual(certificate_login.getCsrId(), None)
ssl_certificate = x509.load_pem_x509_certificate(compute_node_certificate)
self.assertEqual(len(ssl_certificate.subject), 2)
......@@ -69,7 +69,7 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
self.assertEqual(certificate_login.getReference().decode("UTF-8"), cn)
# TODO: Should we check for csr_id
#self.assertTrue(certificate_login.getSourceReference() in compute_node_certificate)
#self.assertTrue(certificate_login.getCsrId() in compute_node_certificate)
def test_generateCertificate_twice(self):
self.login(self.compute_node.getUserId())
......@@ -85,7 +85,7 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
certificate_login = certificate_login_list[0]
self.assertEqual(certificate_login.getValidationState(), 'validated')
self.assertNotEqual(certificate_login.getReference(), None)
self.assertNotEqual(certificate_login.getSourceReference(), None)
self.assertNotEqual(certificate_login.getCsrId(), None)
ssl_certificate = x509.load_pem_x509_certificate(compute_node_certificate)
self.assertEqual(len(ssl_certificate.subject), 2)
......@@ -93,7 +93,7 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
self.assertEqual(certificate_login.getReference().decode("UTF-8"), cn)
# TODO: Should we check for csr_id
#self.assertTrue(certificate_login.getSourceReference() in compute_node_certificate)
#self.assertTrue(certificate_login.getCsrId() in compute_node_certificate)
self.assertRaises(ValueError, self.compute_node.generateCertificate)
self.assertEqual(None, self.portal.REQUEST.get('compute_node_key'))
......@@ -283,7 +283,7 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
certificate_login = certificate_login_list[0]
self.assertEqual(certificate_login.getValidationState(), 'validated')
self.assertNotEqual(certificate_login.getReference(), None)
self.assertNotEqual(certificate_login.getSourceReference(), None)
self.assertNotEqual(certificate_login.getCsrId(), None)
ssl_certificate = x509.load_pem_x509_certificate(compute_node_certificate)
self.assertEqual(len(ssl_certificate.subject), 2)
......@@ -291,7 +291,7 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
self.assertEqual(certificate_login.getReference().decode("UTF-8"), cn)
# TODO: Should we check for csr_id
#self.assertTrue(certificate_login.getSourceReference() in compute_node_certificate)
#self.assertTrue(certificate_login.getCsrId() in compute_node_certificate)
self.assertNotEqual(certificate_login.getReference(),
self.compute_node.getReference())
......@@ -323,7 +323,7 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
certificate_login = certificate_login_list[0]
self.assertEqual(certificate_login.getValidationState(), 'validated')
self.assertNotEqual(certificate_login.getReference(), None)
self.assertNotEqual(certificate_login.getSourceReference(), None)
self.assertNotEqual(certificate_login.getCsrId(), None)
self.assertNotEqual(certificate_login.getReference(),
self.compute_node.getReference())
......@@ -333,7 +333,7 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
self.assertEqual(certificate_login.getReference().decode("UTF-8"), cn)
# TODO: Should we check for csr_id
#self.assertTrue(certificate_login.getSourceReference() in compute_node_certificate)
#self.assertTrue(certificate_login.getCsrId() in compute_node_certificate)
self.compute_node.revokeCertificate()
self.assertEqual(None, self.portal.REQUEST.get('compute_node_key'))
......@@ -359,11 +359,11 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
certificate_login_list = self.compute_node.objectValues(portal_type="Certificate Login")
self.assertEqual(len(certificate_login_list), 1)
certificate_login = certificate_login_list[0]
source_reference = certificate_login.getSourceReference()
source_reference = certificate_login.getCsrId()
self.assertEqual(certificate_login.getValidationState(), 'validated')
self.assertNotEqual(certificate_login.getReference(), None)
self.assertNotEqual(certificate_login.getSourceReference(), None)
self.assertNotEqual(certificate_login.getCsrId(), None)
self.assertNotEqual(certificate_login.getReference(),
self.compute_node.getReference())
......@@ -373,7 +373,7 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
self.assertEqual(certificate_login.getReference().decode("UTF-8"), cn)
# TODO: Should we check for csr_id
#self.assertTrue(certificate_login.getSourceReference() in compute_node_certificate)
#self.assertTrue(certificate_login.getCsrId() in compute_node_certificate)
self.assertNotEqual(None, source_reference)
self.compute_node.revokeCertificate()
......@@ -385,7 +385,7 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
self.assertNotEqual(compute_node_certificate, self.portal.REQUEST.get('compute_node_certificate'))
self.assertEqual(certificate_login.getValidationState(), 'invalidated')
self.assertEqual(certificate_login.getSourceReference(), source_reference)
self.assertEqual(certificate_login.getCsrId(), source_reference)
self.assertNotEqual(certificate_login.getReference(), None)
certificate_login_list = self.compute_node.objectValues(portal_type="Certificate Login")
......@@ -393,15 +393,15 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
new_certificate_login = [i for i in certificate_login_list \
if i.getId() != certificate_login.getId()][0]
source_reference = certificate_login.getSourceReference()
source_reference = certificate_login.getCsrId()
self.assertEqual(new_certificate_login.getValidationState(), 'validated')
self.assertNotEqual(new_certificate_login.getReference(), None)
self.assertNotEqual(new_certificate_login.getReference(),
certificate_login.getReference())
self.assertNotEqual(new_certificate_login.getSourceReference(), None)
self.assertNotEqual(new_certificate_login.getSourceReference(),
certificate_login.getSourceReference())
self.assertNotEqual(new_certificate_login.getCsrId(), None)
self.assertNotEqual(new_certificate_login.getCsrId(),
certificate_login.getCsrId())
compute_node_certificate = self.portal.REQUEST.get('compute_node_certificate')
ssl_certificate = x509.load_pem_x509_certificate(compute_node_certificate)
......@@ -411,7 +411,7 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
self.assertNotEqual(certificate_login.getReference().decode("UTF-8"), cn)
# TODO: Should we check for csr_id
#self.assertTrue(certificate_login.getSourceReference() in compute_node_certificate)
#self.assertTrue(certificate_login.getCsrId() in compute_node_certificate)
self.assertNotEqual(certificate_login.getReference(),
self.compute_node.getReference())
......@@ -427,11 +427,11 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
certificate_login_list = self.compute_node.objectValues(portal_type="Certificate Login")
self.assertEqual(len(certificate_login_list), 1)
certificate_login = certificate_login_list[0]
source_reference = certificate_login.getSourceReference()
source_reference = certificate_login.getCsrId()
self.assertEqual(certificate_login.getValidationState(), 'validated')
self.assertNotEqual(certificate_login.getReference(), None)
self.assertNotEqual(certificate_login.getSourceReference(), None)
self.assertNotEqual(certificate_login.getCsrId(), None)
ssl_certificate = x509.load_pem_x509_certificate(compute_node_certificate)
self.assertEqual(len(ssl_certificate.subject), 2)
......@@ -450,7 +450,7 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
self.assertNotEqual(compute_node_certificate, self.portal.REQUEST.get('compute_node_certificate'))
self.assertEqual(certificate_login.getValidationState(), 'invalidated')
self.assertEqual(certificate_login.getSourceReference(), source_reference)
self.assertEqual(certificate_login.getCsrId(), source_reference)
self.assertNotEqual(certificate_login.getReference(), None)
certificate_login_list = self.compute_node.objectValues(portal_type="Certificate Login")
......@@ -458,15 +458,15 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
new_certificate_login = [i for i in certificate_login_list \
if i.getId() != certificate_login.getId()][0]
source_reference = certificate_login.getSourceReference()
source_reference = certificate_login.getCsrId()
self.assertEqual(new_certificate_login.getValidationState(), 'validated')
self.assertNotEqual(new_certificate_login.getReference(), None)
self.assertNotEqual(new_certificate_login.getReference(),
certificate_login.getReference())
self.assertNotEqual(new_certificate_login.getSourceReference(), None)
self.assertNotEqual(new_certificate_login.getSourceReference(),
certificate_login.getSourceReference())
self.assertNotEqual(new_certificate_login.getCsrId(), None)
self.assertNotEqual(new_certificate_login.getCsrId(),
certificate_login.getCsrId())
compute_node_certificate = self.portal.REQUEST.get('compute_node_certificate')
ssl_certificate = x509.load_pem_x509_certificate(compute_node_certificate)
self.assertEqual(len(ssl_certificate.subject), 2)
......@@ -485,7 +485,7 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
self.assertNotEqual(compute_node_certificate, self.portal.REQUEST.get('compute_node_certificate'))
self.assertEqual(new_certificate_login.getValidationState(), 'invalidated')
self.assertNotEqual(new_certificate_login.getSourceReference(), source_reference)
self.assertNotEqual(new_certificate_login.getCsrId(), source_reference)
self.assertNotEqual(new_certificate_login.getReference(), None)
certificate_login_list = self.compute_node.objectValues(portal_type="Certificate Login")
......@@ -494,15 +494,15 @@ class TestSlapOSCoreComputeNodeSlapInterfaceWorkflow(SlapOSTestCaseMixin):
third_certificate_login = [i for i in certificate_login_list \
if i.getId() not in [certificate_login.getId(), new_certificate_login.getId()]][0]
source_reference = new_certificate_login.getSourceReference()
source_reference = new_certificate_login.getCsrId()
self.assertEqual(third_certificate_login.getValidationState(), 'validated')
self.assertNotEqual(third_certificate_login.getReference(), None)
self.assertNotEqual(third_certificate_login.getReference(),
certificate_login.getReference())
self.assertNotEqual(third_certificate_login.getSourceReference(), None)
self.assertNotEqual(third_certificate_login.getSourceReference(),
new_certificate_login.getSourceReference())
self.assertNotEqual(third_certificate_login.getCsrId(), None)
self.assertNotEqual(third_certificate_login.getCsrId(),
new_certificate_login.getCsrId())
compute_node_certificate = self.portal.REQUEST.get('compute_node_certificate')
ssl_certificate = x509.load_pem_x509_certificate(compute_node_certificate)
......
......@@ -1216,7 +1216,7 @@ class TestSlapOSCoreInstanceSlapInterfaceWorkflowTransfer(SlapOSTestCaseMixin):
self.assertEqual(certificate_login.getValidationState(), 'validated')
self.assertNotEqual(certificate_login.getReference(), None)
self.assertNotEqual(certificate_login.getSourceReference(), None)
self.assertNotEqual(certificate_login.getCsrId(), None)
ssl_certificate = x509.load_pem_x509_certificate(self.software_instance.getSslCertificate())
self.assertEqual(len(ssl_certificate.subject), 2)
cn = [i.value for i in ssl_certificate.subject if i.oid == NameOID.COMMON_NAME][0]
......@@ -1249,7 +1249,7 @@ class TestSlapOSCoreInstanceSlapInterfaceWorkflowTransfer(SlapOSTestCaseMixin):
certificate_login = certificate_login_list[0]
self.assertEqual(certificate_login.getValidationState(), 'validated')
self.assertNotEqual(certificate_login.getReference(), None)
self.assertNotEqual(certificate_login.getSourceReference(), None)
self.assertNotEqual(certificate_login.getCsrId(), None)
self.assertNotEqual(self.software_instance.getSslKey(),
ssl_key)
......@@ -1276,11 +1276,11 @@ class TestSlapOSCoreInstanceSlapInterfaceWorkflowTransfer(SlapOSTestCaseMixin):
self.assertEqual(another_certificate_login.getValidationState(), 'validated')
self.assertNotEqual(another_certificate_login.getReference(), None)
self.assertNotEqual(another_certificate_login.getSourceReference(), None)
self.assertNotEqual(another_certificate_login.getCsrId(), None)
self.assertEqual(certificate_login.getValidationState(), 'invalidated')
self.assertNotEqual(certificate_login.getReference(),
another_certificate_login.getReference())
self.assertNotEqual(certificate_login.getSourceReference(),
another_certificate_login.getSourceReference())
self.assertNotEqual(certificate_login.getCsrId(),
another_certificate_login.getCsrId())
......@@ -554,7 +554,7 @@ class TestPerson_get_Certificate(TestSlapOSHalJsonStyleMixin):
self.assertSameSet(response_dict.keys(), ["common_name", "certificate", "id", "key"])
self.assertEqual(response_dict["id"], login.getSourceReference())
self.assertEqual(response_dict["id"], login.getCsrId())
self.assertEqual(json.dumps(response_dict["common_name"]), json.dumps(login.getReference()))
self.assertEqual(self.portal.REQUEST.RESPONSE.getStatus(), 200)
......@@ -568,11 +568,11 @@ class TestPerson_get_Certificate(TestSlapOSHalJsonStyleMixin):
self.assertEqual("validated" , login.getValidationState())
self.assertEqual("validated" , new_login.getValidationState())
self.assertNotEqual(login.getReference(), new_login.getReference())
self.assertNotEqual(login.getSourceReference(), new_login.getSourceReference())
self.assertNotEqual(login.getCsrId(), new_login.getCsrId())
self.assertSameSet(new_response_dict.keys(), ["common_name", "certificate", "id", "key"])
self.assertEqual(json.dumps(new_response_dict["common_name"]), json.dumps(new_login.getReference()))
self.assertEqual(new_response_dict["id"], new_login.getSourceReference())
self.assertEqual(new_response_dict["id"], new_login.getCsrId())
self.assertNotEqual(new_response_dict["common_name"], response_dict["common_name"])
self.assertNotEqual(new_response_dict["id"], response_dict["id"])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment