Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Rafael Monnerat
erp5
Commits
83e06ad5
Commit
83e06ad5
authored
Sep 29, 2023
by
Rafael Monnerat
👻
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_certificate_authority: Update test for Person/Certificate Login
parent
c2054c7c
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
133 additions
and
43 deletions
+133
-43
bt5/erp5_certificate_authority/MixinTemplateItem/portal_components/mixin.erp5.CertificateLoginMixin.py
...tem/portal_components/mixin.erp5.CertificateLoginMixin.py
+11
-7
bt5/erp5_certificate_authority/TestTemplateItem/portal_components/test.erp5.testCertificateAuthorityPerson.py
...al_components/test.erp5.testCertificateAuthorityPerson.py
+122
-36
No files found.
bt5/erp5_certificate_authority/MixinTemplateItem/portal_components/mixin.erp5.CertificateLoginMixin.py
View file @
83e06ad5
...
...
@@ -72,9 +72,11 @@ class CertificateLoginMixin:
certificate_dict
=
{
"common_name"
:
self
.
getReference
()
}
if
self
.
getReference
and
self
.
getSourceReference
():
if
self
.
getReference
()
and
self
.
getSourceReference
():
if
csr
is
not
None
:
raise
ValueError
(
"This certificate already"
)
certificate_dict
[
"id"
]
=
self
.
getSourceReference
()
crt_pem
=
caucase_connector
.
getCertificate
(
self
.
getSourceReference
(
))
crt_pem
=
caucase_connector
.
getCertificate
(
int
(
self
.
getSourceReference
()
))
certificate_dict
[
"certificate"
]
=
crt_pem
# We should assert that reference is the CN of crt_pem
return
certificate_dict
...
...
@@ -111,7 +113,7 @@ class CertificateLoginMixin:
else
:
return
self
.
_getCertificate
(
csr
=
csr
)
def
_revokeCertificate
(
self
):
def
_revokeCertificate
(
self
,
key_pem
=
None
):
if
self
.
getDestinationReference
()
is
not
None
or
(
self
.
getReference
()
is
not
None
and
self
.
getSourceReference
()
is
None
):
...
...
@@ -119,12 +121,14 @@ class CertificateLoginMixin:
if
self
.
getSourceReference
()
is
not
None
:
caucase_connector
=
self
.
_getCaucaseConnector
()
crt_pem
=
caucase_connector
.
getCertificate
(
self
.
getSourceReference
())
caucase_connector
.
revokeCertificate
(
crt_pem
)
crt_pem
=
caucase_connector
.
getCertificate
(
int
(
self
.
getSourceReference
()))
if
key_pem
is
None
:
return
caucase_connector
.
revokeCertificate
(
crt_pem
,
key_pem
)
return
caucase_connector
.
revokeCertificate
(
crt_pem
)
else
:
raise
ValueError
(
"No certificate found to revoke!"
)
security
.
declarePrivate
(
'revokeCertificate'
)
def
revokeCertificate
(
self
):
def
revokeCertificate
(
self
,
key_pem
=
None
):
"""Revokes existing certificate"""
self
.
_revokeCertificate
()
\ No newline at end of file
self
.
_revokeCertificate
(
key_pem
=
key_pem
)
\ No newline at end of file
bt5/erp5_certificate_authority/TestTemplateItem/portal_components/test.erp5.testCertificateAuthorityPerson.py
View file @
83e06ad5
This diff is collapsed.
Click to expand it.
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