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
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
Thomas Leymonerie
slapos.core
Commits
67bb6bc9
Commit
67bb6bc9
authored
Jun 15, 2020
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_jio: Added tests for ComputerNetwork_invalidate, Computer_[get|revoke]Certificate
parent
302ec02d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
64 additions
and
0 deletions
+64
-0
master/bt5/slapos_jio/TestTemplateItem/portal_components/test.erp5.testSlapOSHalJsonStyleSkins.py
...ortal_components/test.erp5.testSlapOSHalJsonStyleSkins.py
+64
-0
No files found.
master/bt5/slapos_jio/TestTemplateItem/portal_components/test.erp5.testSlapOSHalJsonStyleSkins.py
View file @
67bb6bc9
...
...
@@ -706,6 +706,70 @@ class TestPerson_testLoginExistence(TestSlapOSHalJsonStyleMixin):
def
test_Person_testLoginExistence_facebook
(
self
):
self
.
test_Person_testLoginExistence
(
portal_type
=
"Facebook Login"
)
class
TestERP5Site_invalidate
(
TestSlapOSHalJsonStyleMixin
):
def
test_ERP5Site_invalidate
(
self
,
portal_type
=
"ERP5 Login"
):
person
=
self
.
_makePerson
(
user
=
0
)
login
=
self
.
generateNewId
()
login_doc
=
person
.
newContent
(
portal_type
=
portal_type
,
reference
=
login
)
login_doc
.
validate
()
self
.
tic
()
self
.
changeSkin
(
"Hal"
)
login_doc
.
ERP5Login_invalidate
()
self
.
assertEqual
(
login_doc
.
getValidationState
(),
'invalidated'
)
# It shouldn't raise
login_doc
.
ERP5Login_invalidate
()
self
.
assertEqual
(
login_doc
.
getValidationState
(),
'invalidated'
)
def
test_ERP5Site_invalidate_google
(
self
):
self
.
test_ERP5Site_invalidate
(
portal_type
=
"Google Login"
)
def
test_ERP5Site_invalidate_facebook
(
self
):
self
.
test_ERP5Site_invalidate
(
portal_type
=
"Facebook Login"
)
class
TestComputer_get_revoke_Certificate
(
TestSlapOSHalJsonStyleMixin
):
def
test_Computer_getCertificate
(
self
):
computer
=
self
.
_makeComputer
()
self
.
assertEqual
(
0
,
len
(
computer
.
objectValues
(
portal_type
=
[
"ERP5 Login"
,
"Certificate Login"
])))
response_dict
=
json
.
loads
(
computer
.
Computer_getCertificate
())
self
.
assertSameSet
(
response_dict
.
keys
(),
[
"certificate"
,
"key"
])
self
.
assertEqual
(
self
.
portal
.
REQUEST
.
RESPONSE
.
getStatus
(),
200
)
response_false
=
json
.
loads
(
computer
.
Computer_getCertificate
())
self
.
assertFalse
(
response_false
)
response_true
=
json
.
loads
(
computer
.
Computer_revokeCertificate
())
self
.
assertTrue
(
response_true
)
response_false
=
json
.
loads
(
computer
.
Computer_revokeCertificate
())
self
.
assertFalse
(
response_false
)
response_dict
=
json
.
loads
(
computer
.
Computer_getCertificate
())
self
.
assertSameSet
(
response_dict
.
keys
(),
[
"certificate"
,
"key"
])
self
.
assertEqual
(
self
.
portal
.
REQUEST
.
RESPONSE
.
getStatus
(),
200
)
class
TestComputerNetwork_invalidate
(
TestSlapOSHalJsonStyleMixin
):
def
test_ComputerNetwork_invalidate
(
self
):
network
=
self
.
_makeComputerNetwork
()
self
.
assertEqual
(
network
.
getValidationState
(),
"validated"
)
self
.
changeSkin
(
"Hal"
)
network
.
ComputerNetwork_invalidate
()
self
.
assertEqual
(
network
.
getValidationState
(),
"invalidated"
)
# Call again to ensure it doesn't raise
network
.
ComputerNetwork_invalidate
()
self
.
assertEqual
(
network
.
getValidationState
(),
"invalidated"
)
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