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
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
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Leo Le Bouter
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
Changes
2
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):
...
@@ -186,15 +186,17 @@ class CertificateAuthorityTool(BaseTool):
# {key, certificate, id, common_name}
# {key, certificate, id, common_name}
if
not
common_name
:
if
not
common_name
:
raise
ValueError
(
"Invalid common name: %r"
%
common_name
)
raise
ValueError
(
"Invalid common name: %r"
%
common_name
)
self
.
_checkCertificateAuthority
()
self
.
_lockCertificateAuthority
()
index
=
open
(
self
.
index
).
read
().
splitlines
()
index
=
open
(
self
.
index
).
read
().
splitlines
()
valid_line_list
=
[
q
for
q
in
index
if
q
.
startswith
(
'V'
)
and
valid_line_list
=
[
q
for
q
in
index
if
q
.
startswith
(
'V'
)
and
(
'CN=%s/'
%
common_name
in
q
)]
(
'CN=%s/'
%
common_name
in
q
)]
if
len
(
valid_line_list
)
>=
1
:
if
len
(
valid_line_list
)
>=
1
:
self
.
_unlockCertificateAuthority
()
raise
ValueError
(
'The common name %r already has a certificate'
raise
ValueError
(
'The common name %r already has a certificate'
'please revoke it before request a new one..'
%
common_name
)
'please revoke it before request a new one..'
%
common_name
)
self
.
_checkCertificateAuthority
()
self
.
_lockCertificateAuthority
()
try
:
try
:
new_id
=
open
(
self
.
serial
,
'r'
).
read
().
strip
().
lower
()
new_id
=
open
(
self
.
serial
,
'r'
).
read
().
strip
().
lower
()
key
=
os
.
path
.
join
(
self
.
certificate_authority_path
,
'private'
,
key
=
os
.
path
.
join
(
self
.
certificate_authority_path
,
'private'
,
...
...
product/ERP5/tests/testCertificateAuthorityTool.py
View file @
79071ceb
...
@@ -75,8 +75,6 @@ class TestCertificateAuthority(ERP5TypeTestCase):
...
@@ -75,8 +75,6 @@ class TestCertificateAuthority(ERP5TypeTestCase):
self
.
assertTrue
(
'CN=%s'
%
user_id
in
certificate
[
'certificate'
])
self
.
assertTrue
(
'CN=%s'
%
user_id
in
certificate
[
'certificate'
])
person
.
revokeCertificate
()
person
.
revokeCertificate
()
@
unittest
.
skip
(
"""Will be fixed when we rewrite certificate autority to use caucase."""
)
def
test_person_request_certificate_twice
(
self
):
def
test_person_request_certificate_twice
(
self
):
user_id
,
login
=
self
.
_createPerson
()
user_id
,
login
=
self
.
_createPerson
()
self
.
loginByUserName
(
login
)
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