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
Ophélie Gagnard
slapos.core
Commits
4d430168
Commit
4d430168
authored
Jan 02, 2019
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_erp5: Add Group Role test for Login documents and introduce a portal type coverage test
parent
3c91287f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
5 deletions
+44
-5
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5GroupRoleSecurity.py
...l_components/test.erp5.testSlapOSERP5GroupRoleSecurity.py
+44
-5
No files found.
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5GroupRoleSecurity.py
View file @
4d430168
...
@@ -2,6 +2,22 @@
...
@@ -2,6 +2,22 @@
from
erp5.component.test.SlapOSTestCaseMixin
import
SlapOSTestCaseMixinWithAbort
from
erp5.component.test.SlapOSTestCaseMixin
import
SlapOSTestCaseMixinWithAbort
from
AccessControl
import
getSecurityManager
from
AccessControl
import
getSecurityManager
class
TestSlapOSGroupRoleSecurityCoverage
(
SlapOSTestCaseMixinWithAbort
):
def
testCoverage
(
self
):
""" Test which Portal types are not covered by this test.
"""
test_source_code
=
self
.
portal
.
portal_components
[
'test.erp5.testSlapOSERP5GroupRoleSecurity'
].
getTextContent
()
test_list
=
[]
for
pt
in
self
.
portal
.
portal_types
.
objectValues
():
if
len
(
pt
.
contentValues
(
portal_type
=
"Role Information"
))
>
0
:
test_klass
=
"class Test%s"
%
""
.
join
(
pt
.
getId
().
split
(
" "
))
if
test_klass
not
in
test_source_code
:
test_list
.
append
(
test_klass
)
self
.
assertEqual
(
test_list
,
[])
class
TestSlapOSGroupRoleSecurityMixin
(
SlapOSTestCaseMixinWithAbort
):
class
TestSlapOSGroupRoleSecurityMixin
(
SlapOSTestCaseMixinWithAbort
):
def
afterSetUp
(
self
):
def
afterSetUp
(
self
):
...
@@ -511,12 +527,33 @@ class TestPerson(TestSlapOSGroupRoleSecurityMixin):
...
@@ -511,12 +527,33 @@ class TestPerson(TestSlapOSGroupRoleSecurityMixin):
self
.
assertRoles
(
person
,
shadow_reference
,
[
'Auditor'
])
self
.
assertRoles
(
person
,
shadow_reference
,
[
'Auditor'
])
self
.
assertRoles
(
person
,
self
.
user_id
,
[
'Owner'
])
self
.
assertRoles
(
person
,
self
.
user_id
,
[
'Owner'
])
# XXX Uncommment once facebook and google login be merged.
def
test_TheUserHimself_Facebook
(
self
):
# def test_TheUserHimself_Facebook(self):
self
.
test_TheUserHimself
(
login_portal_type
=
"Facebook Login"
)
# self.test_TheUserHimself(login_portal_type="Facebook Login")
def
test_TheUserHimself_Google
(
self
):
self
.
test_TheUserHimself
(
login_portal_type
=
"Google Login"
)
class
TestERP5Login
(
TestSlapOSGroupRoleSecurityMixin
):
login_portal_type
=
"ERP5 Login"
def
test_TheUserHimself
(
self
):
person
=
self
.
portal
.
person_module
.
newContent
(
portal_type
=
'Person'
)
login
=
person
.
newContent
(
portal_type
=
self
.
login_portal_type
)
person
.
updateLocalRolesOnSecurityGroups
()
login
.
updateLocalRolesOnSecurityGroups
()
self
.
assertSecurityGroup
(
login
,
[
self
.
user_id
,
person
.
getUserId
()],
False
)
self
.
assertRoles
(
login
,
person
.
getUserId
(),
[
'Assignee'
])
self
.
assertRoles
(
login
,
self
.
user_id
,
[
'Owner'
])
# def test_TheUserHimself_Google(self):
# self.test_TheUserHimself(login_portal_type="Google Login")
class
TestGoogleLogin
(
TestERP5Login
):
login_portal_type
=
"Google Login"
class
TestFacebookLogin
(
TestERP5Login
):
login_portal_type
=
"Facebook Login"
class
TestPersonModule
(
TestSlapOSGroupRoleSecurityMixin
):
class
TestPersonModule
(
TestSlapOSGroupRoleSecurityMixin
):
def
test
(
self
):
def
test
(
self
):
...
@@ -2210,3 +2247,5 @@ class TestUpgradeDecision(TestSlapOSGroupRoleSecurityMixin):
...
@@ -2210,3 +2247,5 @@ class TestUpgradeDecision(TestSlapOSGroupRoleSecurityMixin):
self
.
assertRoles
(
product
,
'G-COMPANY'
,
[
'Assignor'
])
self
.
assertRoles
(
product
,
'G-COMPANY'
,
[
'Assignor'
])
self
.
assertRoles
(
product
,
person
.
getUserId
(),
[
'Assignee'
])
self
.
assertRoles
(
product
,
person
.
getUserId
(),
[
'Assignee'
])
self
.
assertRoles
(
product
,
self
.
user_id
,
[
'Owner'
])
self
.
assertRoles
(
product
,
self
.
user_id
,
[
'Owner'
])
\ No newline at end of file
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