Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Rafael Monnerat
slapos.core
Commits
9c47ac0f
Commit
9c47ac0f
authored
Nov 14, 2023
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_cloud: Change for certificate authority (source_reference to csr_id)
parent
a2b2f851
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
37 deletions
+37
-37
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudComputeNodeSlapInterfaceWorkflow.py
...t.erp5.testSlapOSCloudComputeNodeSlapInterfaceWorkflow.py
+29
-29
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudInstanceSlapInterfaceWorkflow.py
...test.erp5.testSlapOSCloudInstanceSlapInterfaceWorkflow.py
+5
-5
master/bt5/slapos_jio/TestTemplateItem/portal_components/test.erp5.testSlapOSHalJsonStyleSkins.py
...ortal_components/test.erp5.testSlapOSHalJsonStyleSkins.py
+3
-3
No files found.
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudComputeNodeSlapInterfaceWorkflow.py
View file @
9c47ac0f
...
...
@@ -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
.
get
SourceReference
(),
None
)
self
.
assertNotEqual
(
certificate_login
.
get
CsrId
(),
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.get
SourceReference
() in compute_node_certificate)
#self.assertTrue(certificate_login.get
CsrId
() 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
.
get
SourceReference
(),
None
)
self
.
assertNotEqual
(
certificate_login
.
get
CsrId
(),
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.get
SourceReference
() in compute_node_certificate)
#self.assertTrue(certificate_login.get
CsrId
() 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
.
get
SourceReference
(),
None
)
self
.
assertNotEqual
(
certificate_login
.
get
CsrId
(),
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.get
SourceReference
() in compute_node_certificate)
#self.assertTrue(certificate_login.get
CsrId
() 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
.
get
SourceReference
(),
None
)
self
.
assertNotEqual
(
certificate_login
.
get
CsrId
(),
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.get
SourceReference
() in compute_node_certificate)
#self.assertTrue(certificate_login.get
CsrId
() 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
.
get
SourceReference
()
source_reference
=
certificate_login
.
get
CsrId
()
self
.
assertEqual
(
certificate_login
.
getValidationState
(),
'validated'
)
self
.
assertNotEqual
(
certificate_login
.
getReference
(),
None
)
self
.
assertNotEqual
(
certificate_login
.
get
SourceReference
(),
None
)
self
.
assertNotEqual
(
certificate_login
.
get
CsrId
(),
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.get
SourceReference
() in compute_node_certificate)
#self.assertTrue(certificate_login.get
CsrId
() 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
.
get
SourceReference
(),
source_reference
)
self
.
assertEqual
(
certificate_login
.
get
CsrId
(),
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
.
get
SourceReference
()
source_reference
=
certificate_login
.
get
CsrId
()
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
.
get
SourceReference
(),
None
)
self
.
assertNotEqual
(
new_certificate_login
.
get
SourceReference
(),
certificate_login
.
get
SourceReference
())
self
.
assertNotEqual
(
new_certificate_login
.
get
CsrId
(),
None
)
self
.
assertNotEqual
(
new_certificate_login
.
get
CsrId
(),
certificate_login
.
get
CsrId
())
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.get
SourceReference
() in compute_node_certificate)
#self.assertTrue(certificate_login.get
CsrId
() 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
.
get
SourceReference
()
source_reference
=
certificate_login
.
get
CsrId
()
self
.
assertEqual
(
certificate_login
.
getValidationState
(),
'validated'
)
self
.
assertNotEqual
(
certificate_login
.
getReference
(),
None
)
self
.
assertNotEqual
(
certificate_login
.
get
SourceReference
(),
None
)
self
.
assertNotEqual
(
certificate_login
.
get
CsrId
(),
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
.
get
SourceReference
(),
source_reference
)
self
.
assertEqual
(
certificate_login
.
get
CsrId
(),
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
.
get
SourceReference
()
source_reference
=
certificate_login
.
get
CsrId
()
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
.
get
SourceReference
(),
None
)
self
.
assertNotEqual
(
new_certificate_login
.
get
SourceReference
(),
certificate_login
.
get
SourceReference
())
self
.
assertNotEqual
(
new_certificate_login
.
get
CsrId
(),
None
)
self
.
assertNotEqual
(
new_certificate_login
.
get
CsrId
(),
certificate_login
.
get
CsrId
())
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
.
get
SourceReference
(),
source_reference
)
self
.
assertNotEqual
(
new_certificate_login
.
get
CsrId
(),
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
.
get
SourceReference
()
source_reference
=
new_certificate_login
.
get
CsrId
()
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
.
get
SourceReference
(),
None
)
self
.
assertNotEqual
(
third_certificate_login
.
get
SourceReference
(),
new_certificate_login
.
get
SourceReference
())
self
.
assertNotEqual
(
third_certificate_login
.
get
CsrId
(),
None
)
self
.
assertNotEqual
(
third_certificate_login
.
get
CsrId
(),
new_certificate_login
.
get
CsrId
())
compute_node_certificate
=
self
.
portal
.
REQUEST
.
get
(
'compute_node_certificate'
)
ssl_certificate
=
x509
.
load_pem_x509_certificate
(
compute_node_certificate
)
...
...
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudInstanceSlapInterfaceWorkflow.py
View file @
9c47ac0f
...
...
@@ -1216,7 +1216,7 @@ class TestSlapOSCoreInstanceSlapInterfaceWorkflowTransfer(SlapOSTestCaseMixin):
self
.
assertEqual
(
certificate_login
.
getValidationState
(),
'validated'
)
self
.
assertNotEqual
(
certificate_login
.
getReference
(),
None
)
self
.
assertNotEqual
(
certificate_login
.
get
SourceReference
(),
None
)
self
.
assertNotEqual
(
certificate_login
.
get
CsrId
(),
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
.
get
SourceReference
(),
None
)
self
.
assertNotEqual
(
certificate_login
.
get
CsrId
(),
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
.
get
SourceReference
(),
None
)
self
.
assertNotEqual
(
another_certificate_login
.
get
CsrId
(),
None
)
self
.
assertEqual
(
certificate_login
.
getValidationState
(),
'invalidated'
)
self
.
assertNotEqual
(
certificate_login
.
getReference
(),
another_certificate_login
.
getReference
())
self
.
assertNotEqual
(
certificate_login
.
get
SourceReference
(),
another_certificate_login
.
get
SourceReference
())
self
.
assertNotEqual
(
certificate_login
.
get
CsrId
(),
another_certificate_login
.
get
CsrId
())
master/bt5/slapos_jio/TestTemplateItem/portal_components/test.erp5.testSlapOSHalJsonStyleSkins.py
View file @
9c47ac0f
...
...
@@ -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
.
get
SourceReference
())
self
.
assertEqual
(
response_dict
[
"id"
],
login
.
get
CsrId
())
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
.
get
SourceReference
(),
new_login
.
getSourceReference
())
self
.
assertNotEqual
(
login
.
get
CsrId
(),
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
.
get
SourceReference
())
self
.
assertEqual
(
new_response_dict
[
"id"
],
new_login
.
get
CsrId
())
self
.
assertNotEqual
(
new_response_dict
[
"common_name"
],
response_dict
[
"common_name"
])
self
.
assertNotEqual
(
new_response_dict
[
"id"
],
response_dict
[
"id"
])
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment