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
Labels
Merge Requests
139
Merge Requests
139
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
79071ceb
Commit
79071ceb
authored
Dec 10, 2019
by
Boxiang Sun
Committed by
Rafael Monnerat
Dec 20, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testCertificateAuthorityTool: Enable the duplicate certificate check
parent
44e0d582
Pipeline
#7212
failed with stage
in 0 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
product/ERP5/Tool/CertificateAuthorityTool.py
product/ERP5/Tool/CertificateAuthorityTool.py
+4
-2
product/ERP5/tests/testCertificateAuthorityTool.py
product/ERP5/tests/testCertificateAuthorityTool.py
+0
-2
No files found.
product/ERP5/Tool/CertificateAuthorityTool.py
View file @
79071ceb
...
...
@@ -186,15 +186,17 @@ class CertificateAuthorityTool(BaseTool):
# {key, certificate, id, common_name}
if
not
common_name
:
raise
ValueError
(
"Invalid common name: %r"
%
common_name
)
self
.
_checkCertificateAuthority
()
self
.
_lockCertificateAuthority
()
index
=
open
(
self
.
index
).
read
().
splitlines
()
valid_line_list
=
[
q
for
q
in
index
if
q
.
startswith
(
'V'
)
and
(
'CN=%s/'
%
common_name
in
q
)]
if
len
(
valid_line_list
)
>=
1
:
self
.
_unlockCertificateAuthority
()
raise
ValueError
(
'The common name %r already has a certificate'
'please revoke it before request a new one..'
%
common_name
)
self
.
_checkCertificateAuthority
()
self
.
_lockCertificateAuthority
()
try
:
new_id
=
open
(
self
.
serial
,
'r'
).
read
().
strip
().
lower
()
key
=
os
.
path
.
join
(
self
.
certificate_authority_path
,
'private'
,
...
...
product/ERP5/tests/testCertificateAuthorityTool.py
View file @
79071ceb
...
...
@@ -75,8 +75,6 @@ class TestCertificateAuthority(ERP5TypeTestCase):
self
.
assertTrue
(
'CN=%s'
%
user_id
in
certificate
[
'certificate'
])
person
.
revokeCertificate
()
@
unittest
.
skip
(
"""Will be fixed when we rewrite certificate autority to use caucase."""
)
def
test_person_request_certificate_twice
(
self
):
user_id
,
login
=
self
.
_createPerson
()
self
.
loginByUserName
(
login
)
...
...
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