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
e071b05e
Commit
e071b05e
authored
Jun 15, 2020
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_jio: Added test for Person_getCertificate and Person_revokeCertificate
parent
519e4138
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
0 deletions
+46
-0
master/bt5/slapos_jio/TestTemplateItem/portal_components/test.erp5.testSlapOSHalJsonStyleSkins.py
...ortal_components/test.erp5.testSlapOSHalJsonStyleSkins.py
+46
-0
No files found.
master/bt5/slapos_jio/TestTemplateItem/portal_components/test.erp5.testSlapOSHalJsonStyleSkins.py
View file @
e071b05e
...
...
@@ -635,3 +635,49 @@ class TestPerson_newLogin(TestSlapOSHalJsonStyleMixin):
self
.
assertEqual
(
self
.
portal
.
REQUEST
.
RESPONSE
.
getStatus
(),
200
)
self
.
assertIn
(
person
.
getRelativeUrl
(),
result
)
class
TestPerson_get_revoke_Certificate
(
TestSlapOSHalJsonStyleMixin
):
def
test_Person_getCertificate_unauthorized
(
self
):
person
=
self
.
_makePerson
(
user
=
1
)
self
.
assertEqual
(
1
,
len
(
person
.
objectValues
(
portal_type
=
"ERP5 Login"
)))
self
.
assertEqual
(
person
.
Person_getCertificate
(),
{})
self
.
assertEqual
(
self
.
portal
.
REQUEST
.
RESPONSE
.
getStatus
(),
403
)
def
test_Person_revokeCertificate_unauthorized
(
self
):
person
=
self
.
_makePerson
(
user
=
1
)
self
.
assertEqual
(
1
,
len
(
person
.
objectValues
(
portal_type
=
"ERP5 Login"
)))
self
.
assertEqual
(
person
.
Person_revokeCertificate
(),
None
)
self
.
assertEqual
(
self
.
portal
.
REQUEST
.
RESPONSE
.
getStatus
(),
403
)
def
test_Person_get_revoke_Certificate
(
self
):
person
=
self
.
_makePerson
(
user
=
1
)
self
.
assertEqual
(
1
,
len
(
person
.
objectValues
(
portal_type
=
"ERP5 Login"
)))
self
.
login
(
person
.
getUserId
())
response_dict
=
json
.
loads
(
person
.
Person_getCertificate
())
self
.
assertSameSet
(
response_dict
.
keys
(),
[
"common_name"
,
"certificate"
,
"id"
,
"key"
])
self
.
assertEqual
(
response_dict
[
"common_name"
],
person
.
getUserId
())
self
.
assertEqual
(
self
.
portal
.
REQUEST
.
RESPONSE
.
getStatus
(),
200
)
response_false
=
json
.
loads
(
person
.
Person_getCertificate
())
self
.
assertFalse
(
response_false
)
response_true
=
json
.
loads
(
person
.
Person_revokeCertificate
())
self
.
assertTrue
(
response_true
)
response_false
=
json
.
loads
(
person
.
Person_revokeCertificate
())
self
.
assertFalse
(
response_false
)
response_dict
=
json
.
loads
(
person
.
Person_getCertificate
())
self
.
assertSameSet
(
response_dict
.
keys
(),
[
"common_name"
,
"certificate"
,
"id"
,
"key"
])
self
.
assertEqual
(
response_dict
[
"common_name"
],
person
.
getUserId
())
self
.
assertEqual
(
self
.
portal
.
REQUEST
.
RESPONSE
.
getStatus
(),
200
)
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