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
7
Merge Requests
7
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
Jérome Perrin
erp5
Commits
82235674
Commit
82235674
authored
Dec 09, 2016
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: migrate to ERP5 Login authentication.
parent
e3f117a8
Changes
21
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
474 additions
and
264 deletions
+474
-264
bt5/erp5_user_tutorial_ui_test/SkinTemplateItem/portal_skins/erp5_user_tutorial_ui_test/Zuite_createAnotherFunctionalTestUser.py
...tutorial_ui_test/Zuite_createAnotherFunctionalTestUser.py
+7
-1
bt5/erp5_user_tutorial_ui_test/SkinTemplateItem/portal_skins/erp5_user_tutorial_ui_test/Zuite_createFunctionalTestUser.py
...5_user_tutorial_ui_test/Zuite_createFunctionalTestUser.py
+7
-1
bt5/erp5_web_renderjs_ui_test/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui_test/ERP5Site_createPersonToAskAccountRecover.py
...derjs_ui_test/ERP5Site_createPersonToAskAccountRecover.py
+6
-1
bt5/erp5_web_ui_test/SkinTemplateItem/portal_skins/erp5_web_ui_test/WebSiteModule_resetWebZuite.py
...tal_skins/erp5_web_ui_test/WebSiteModule_resetWebZuite.py
+8
-1
bt5/erp5_web_ung_role/TestTemplateItem/portal_components/test.erp5.testUNGSecurity.py
...mplateItem/portal_components/test.erp5.testUNGSecurity.py
+15
-0
bt5/erp5_web_ung_theme/TestTemplateItem/portal_components/test.erp5.testUNG.py
...e/TestTemplateItem/portal_components/test.erp5.testUNG.py
+2
-0
bt5/networkcache_erp5/TestTemplateItem/portal_components/test.erp5.ShaSecurityMixin.py
...plateItem/portal_components/test.erp5.ShaSecurityMixin.py
+7
-2
product/ERP5/tests/testAccounting_l10n_fr.py
product/ERP5/tests/testAccounting_l10n_fr.py
+1
-0
product/ERP5/tests/testBug.py
product/ERP5/tests/testBug.py
+1
-0
product/ERP5/tests/testCertificateAuthorityTool.py
product/ERP5/tests/testCertificateAuthorityTool.py
+1
-0
product/ERP5/tests/testERP5Base.py
product/ERP5/tests/testERP5Base.py
+2
-2
product/ERP5/tests/testERP5Commerce.py
product/ERP5/tests/testERP5Commerce.py
+1
-0
product/ERP5/tests/testERP5Credential.py
product/ERP5/tests/testERP5Credential.py
+19
-25
product/ERP5/tests/testPasswordTool.py
product/ERP5/tests/testPasswordTool.py
+71
-41
product/ERP5/tests/testWorklist.py
product/ERP5/tests/testWorklist.py
+1
-0
product/ERP5Banking/tests/TestERP5BankingMixin.py
product/ERP5Banking/tests/TestERP5BankingMixin.py
+4
-0
product/ERP5Catalog/tests/testERP5CatalogSecurityUidOptimization.py
...P5Catalog/tests/testERP5CatalogSecurityUidOptimization.py
+2
-0
product/ERP5Form/tests/testGUIwithSecurity.py
product/ERP5Form/tests/testGUIwithSecurity.py
+1
-0
product/ERP5OOo/tests/testDeferredStyle.py
product/ERP5OOo/tests/testDeferredStyle.py
+6
-1
product/ERP5Security/tests/testERP5Security.py
product/ERP5Security/tests/testERP5Security.py
+308
-188
product/ERP5Type/tests/ERP5TypeTestCase.py
product/ERP5Type/tests/ERP5TypeTestCase.py
+4
-1
No files found.
bt5/erp5_user_tutorial_ui_test/SkinTemplateItem/portal_skins/erp5_user_tutorial_ui_test/Zuite_createAnotherFunctionalTestUser.py
View file @
82235674
...
@@ -12,7 +12,6 @@ if person is None:
...
@@ -12,7 +12,6 @@ if person is None:
title
=
functional_test_username
)
title
=
functional_test_username
)
person
.
edit
(
reference
=
functional_test_username
,
person
.
edit
(
reference
=
functional_test_username
,
password
=
howto_dict
[
'functional_test_user_password'
],
default_email_text
=
howto_dict
[
'functional_test_user_email'
])
default_email_text
=
howto_dict
[
'functional_test_user_email'
])
person
.
validate
()
person
.
validate
()
...
@@ -23,6 +22,13 @@ if person is None:
...
@@ -23,6 +22,13 @@ if person is None:
function
=
'company/manager'
)
function
=
'company/manager'
)
assignment
.
open
()
assignment
.
open
()
login
=
person
.
newContent
(
portal_type
=
'ERP5 Login'
,
reference
=
functional_test_username
,
password
=
howto_dict
[
'functional_test_user_password'
],
)
login
.
validate
()
# XXX (lucas): These tests must be able to run on an instance without security.
# XXX (lucas): These tests must be able to run on an instance without security.
for
role
in
(
'Assignee'
,
'Assignor'
,
'Associate'
,
'Auditor'
,
'Owner'
):
for
role
in
(
'Assignee'
,
'Assignor'
,
'Associate'
,
'Auditor'
,
'Owner'
):
portal
.
acl_users
.
zodb_roles
.
assignRoleToPrincipal
(
role
,
person
.
Person_getUserId
())
portal
.
acl_users
.
zodb_roles
.
assignRoleToPrincipal
(
role
,
person
.
Person_getUserId
())
...
...
bt5/erp5_user_tutorial_ui_test/SkinTemplateItem/portal_skins/erp5_user_tutorial_ui_test/Zuite_createFunctionalTestUser.py
View file @
82235674
...
@@ -12,7 +12,6 @@ if person is None:
...
@@ -12,7 +12,6 @@ if person is None:
title
=
functional_test_username
)
title
=
functional_test_username
)
person
.
edit
(
reference
=
functional_test_username
,
person
.
edit
(
reference
=
functional_test_username
,
password
=
howto_dict
[
'functional_test_user_password'
],
default_email_text
=
howto_dict
[
'functional_test_user_email'
])
default_email_text
=
howto_dict
[
'functional_test_user_email'
])
person
.
validate
()
person
.
validate
()
...
@@ -23,6 +22,13 @@ if person is None:
...
@@ -23,6 +22,13 @@ if person is None:
function
=
'company/manager'
)
function
=
'company/manager'
)
assignment
.
open
()
assignment
.
open
()
login
=
person
.
newContent
(
portal_type
=
'ERP5 Login'
,
reference
=
functional_test_username
,
password
=
howto_dict
[
'functional_test_user_password'
],
)
login
.
validate
()
# XXX (lucas): These tests must be able to run on an instance without security.
# XXX (lucas): These tests must be able to run on an instance without security.
for
role
in
(
'Assignee'
,
'Assignor'
,
'Associate'
,
'Auditor'
,
'Owner'
):
for
role
in
(
'Assignee'
,
'Assignor'
,
'Associate'
,
'Auditor'
,
'Owner'
):
portal
.
acl_users
.
zodb_roles
.
assignRoleToPrincipal
(
role
,
person
.
Person_getUserId
())
portal
.
acl_users
.
zodb_roles
.
assignRoleToPrincipal
(
role
,
person
.
Person_getUserId
())
...
...
bt5/erp5_web_renderjs_ui_test/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui_test/ERP5Site_createPersonToAskAccountRecover.py
View file @
82235674
...
@@ -11,10 +11,15 @@ else:
...
@@ -11,10 +11,15 @@ else:
person
=
person_module
.
newContent
(
portal_type
=
"Person"
,
person
=
person_module
.
newContent
(
portal_type
=
"Person"
,
reference
=
user_id
,
reference
=
user_id
,
id
=
user_id
,
id
=
user_id
,
password
=
new_password
,
default_email_text
=
"userA@example.invalid"
)
default_email_text
=
"userA@example.invalid"
)
assignment
=
person
.
newContent
(
portal_type
=
'Assignment'
)
assignment
=
person
.
newContent
(
portal_type
=
'Assignment'
)
assignment
.
open
()
assignment
.
open
()
login
=
person
.
newContent
(
portal_type
=
'ERP5 Login'
,
reference
=
user_id
,
password
=
new_password
,
)
login
.
validate
()
# Make sure always a new password
# Make sure always a new password
person
.
setPassword
(
new_password
)
person
.
setPassword
(
new_password
)
...
...
bt5/erp5_web_ui_test/SkinTemplateItem/portal_skins/erp5_web_ui_test/WebSiteModule_resetWebZuite.py
View file @
82235674
...
@@ -27,7 +27,7 @@ if not portal.person_module.has_key('test_webmaster'):
...
@@ -27,7 +27,7 @@ if not portal.person_module.has_key('test_webmaster'):
else
:
else
:
person
=
portal
.
person_module
.
test_webmaster
person
=
portal
.
person_module
.
test_webmaster
person
.
edit
(
first_name
=
'Test'
,
last_name
=
'Webmaster'
,
person
.
edit
(
first_name
=
'Test'
,
last_name
=
'Webmaster'
,
reference
=
'test_webmaster'
,
password
=
'test_webmaster'
)
reference
=
'test_webmaster'
)
person
.
setRole
(
'internal'
)
person
.
setRole
(
'internal'
)
if
not
len
(
person
.
objectValues
(
portal_type
=
'Assignment'
)):
if
not
len
(
person
.
objectValues
(
portal_type
=
'Assignment'
)):
assignment
=
person
.
newContent
(
portal_type
=
'Assignment'
)
assignment
=
person
.
newContent
(
portal_type
=
'Assignment'
)
...
@@ -36,6 +36,13 @@ if not len(person.objectValues(portal_type='Assignment')):
...
@@ -36,6 +36,13 @@ if not len(person.objectValues(portal_type='Assignment')):
stop_date
=
DateTime
(
'2990/12/31'
))
stop_date
=
DateTime
(
'2990/12/31'
))
if
assignment
.
getValidationState
()
!=
'open'
:
if
assignment
.
getValidationState
()
!=
'open'
:
assignment
.
open
()
assignment
.
open
()
if
not
len
(
person
.
objectValues
(
portal_type
=
'ERP5 Login'
)):
login
=
person
.
newContent
(
portal_type
=
'ERP5 Login'
,
reference
=
'test_webmaster'
,
password
=
'test_webmaster'
,
)
login
.
validate
()
if
person
.
getValidationState
()
!=
'validated'
:
if
person
.
getValidationState
()
!=
'validated'
:
person
.
validate
()
person
.
validate
()
...
...
bt5/erp5_web_ung_role/TestTemplateItem/portal_components/test.erp5.testUNGSecurity.py
View file @
82235674
...
@@ -51,6 +51,11 @@ class TestUNGSecurity(ERP5TypeTestCase):
...
@@ -51,6 +51,11 @@ class TestUNGSecurity(ERP5TypeTestCase):
assignment
=
person
.
newContent
(
portal_type
=
'Assignment'
)
assignment
=
person
.
newContent
(
portal_type
=
'Assignment'
)
assignment
.
setFunction
(
"function/ung_user"
)
assignment
.
setFunction
(
"function/ung_user"
)
assignment
.
open
()
assignment
.
open
()
login
=
person
.
newContent
(
portal_type
=
'ERP5 Login'
,
reference
=
'ung_user'
,
)
login
.
validate
()
self
.
tic
()
self
.
tic
()
def
testERP5Site_createNewWebDocumentAsAnonymous
(
self
):
def
testERP5Site_createNewWebDocumentAsAnonymous
(
self
):
...
@@ -82,6 +87,11 @@ class TestUNGSecurity(ERP5TypeTestCase):
...
@@ -82,6 +87,11 @@ class TestUNGSecurity(ERP5TypeTestCase):
assignment
=
person
.
newContent
(
portal_type
=
'Assignment'
)
assignment
=
person
.
newContent
(
portal_type
=
'Assignment'
)
assignment
.
setFunction
(
"function/ung_user"
)
assignment
.
setFunction
(
"function/ung_user"
)
assignment
.
open
()
assignment
.
open
()
login
=
person
.
newContent
(
portal_type
=
'ERP5 Login'
,
reference
=
'ung_user2'
,
)
login
.
validate
()
self
.
tic
()
self
.
tic
()
self
.
loginByUserName
(
"ung_user"
)
self
.
loginByUserName
(
"ung_user"
)
self
.
changeSkin
(
"UNGDoc"
)
self
.
changeSkin
(
"UNGDoc"
)
...
@@ -175,6 +185,11 @@ class TestUNGSecurity(ERP5TypeTestCase):
...
@@ -175,6 +185,11 @@ class TestUNGSecurity(ERP5TypeTestCase):
assignment
=
person
.
newContent
(
portal_type
=
'Assignment'
)
assignment
=
person
.
newContent
(
portal_type
=
'Assignment'
)
assignment
.
setFunction
(
"function/ung_user"
)
assignment
.
setFunction
(
"function/ung_user"
)
assignment
.
open
()
assignment
.
open
()
login
=
person
.
newContent
(
portal_type
=
'ERP5 Login'
,
reference
=
'ung_user2'
,
)
login
.
validate
()
self
.
tic
()
self
.
tic
()
self
.
loginByUserName
(
"ung_user"
)
self
.
loginByUserName
(
"ung_user"
)
self
.
changeSkin
(
"UNGDoc"
)
self
.
changeSkin
(
"UNGDoc"
)
...
...
bt5/erp5_web_ung_theme/TestTemplateItem/portal_components/test.erp5.testUNG.py
View file @
82235674
...
@@ -133,10 +133,12 @@ class TestUNG(ERP5TypeTestCase):
...
@@ -133,10 +133,12 @@ class TestUNG(ERP5TypeTestCase):
reference
=
"ung_new_user"
)
reference
=
"ung_new_user"
)
assignment
=
person
.
newContent
(
portal_type
=
'Assignment'
)
assignment
=
person
.
newContent
(
portal_type
=
'Assignment'
)
assignment
.
open
()
assignment
.
open
()
person
.
newContent
(
portal_type
=
'ERP5 Login'
,
reference
=
person
.
getReference
()).
validate
()
person
=
portal
.
person_module
.
newContent
(
portal_type
=
'Person'
,
person
=
portal
.
person_module
.
newContent
(
portal_type
=
'Person'
,
reference
=
"ung_new_user2"
)
reference
=
"ung_new_user2"
)
assignment
=
person
.
newContent
(
portal_type
=
'Assignment'
)
assignment
=
person
.
newContent
(
portal_type
=
'Assignment'
)
assignment
.
open
()
assignment
.
open
()
person
.
newContent
(
portal_type
=
'ERP5 Login'
,
reference
=
person
.
getReference
()).
validate
()
self
.
tic
()
self
.
tic
()
self
.
loginByUserName
(
"ung_new_user"
)
self
.
loginByUserName
(
"ung_new_user"
)
self
.
changeSkin
(
"UNGDoc"
)
self
.
changeSkin
(
"UNGDoc"
)
...
...
bt5/networkcache_erp5/TestTemplateItem/portal_components/test.erp5.ShaSecurityMixin.py
View file @
82235674
...
@@ -52,8 +52,13 @@ class ShaSecurityMixin(object):
...
@@ -52,8 +52,13 @@ class ShaSecurityMixin(object):
if
person
is
None
:
if
person
is
None
:
person
=
self
.
portal
.
person_module
.
newContent
(
portal_type
=
'Person'
)
person
=
self
.
portal
.
person_module
.
newContent
(
portal_type
=
'Person'
)
person
.
edit
(
first_name
=
reference
,
person
.
edit
(
first_name
=
reference
,
reference
=
reference
,
reference
=
reference
)
password
=
password
)
login
=
person
.
newContent
(
portal_type
=
'ERP5 Login'
,
reference
=
reference
,
password
=
password
,
)
login
.
validate
()
self
.
tic
()
self
.
tic
()
create
=
True
create
=
True
...
...
product/ERP5/tests/testAccounting_l10n_fr.py
View file @
82235674
...
@@ -82,6 +82,7 @@ class TestAccounting_l10n_fr(AccountingTestCase):
...
@@ -82,6 +82,7 @@ class TestAccounting_l10n_fr(AccountingTestCase):
default_email_text
=
self
.
recipient_email_address
)
default_email_text
=
self
.
recipient_email_address
)
assignment
=
person
.
newContent
(
portal_type
=
'Assignment'
)
assignment
=
person
.
newContent
(
portal_type
=
'Assignment'
)
assignment
.
open
()
assignment
.
open
()
person
.
newContent
(
portal_type
=
'ERP5 Login'
,
reference
=
self
.
username
).
validate
()
self
.
tic
()
self
.
tic
()
uf
=
self
.
portal
.
acl_users
uf
=
self
.
portal
.
acl_users
...
...
product/ERP5/tests/testBug.py
View file @
82235674
...
@@ -126,6 +126,7 @@ class TestBug(ERP5TypeTestCase):
...
@@ -126,6 +126,7 @@ class TestBug(ERP5TypeTestCase):
start_date
=
'1980-01-01'
,
start_date
=
'1980-01-01'
,
stop_date
=
'2099-12-31'
)
stop_date
=
'2099-12-31'
)
assignment
.
open
()
assignment
.
open
()
person
.
newContent
(
portal_type
=
'ERP5 Login'
,
reference
=
'dummy'
).
validate
()
self
.
tic
()
self
.
tic
()
portal_type_list
=
[]
portal_type_list
=
[]
for
portal_type
in
(
self
.
project_portal_type
,
for
portal_type
in
(
self
.
project_portal_type
,
...
...
product/ERP5/tests/testCertificateAuthorityTool.py
View file @
82235674
...
@@ -50,6 +50,7 @@ class TestCertificateAuthority(ERP5TypeTestCase):
...
@@ -50,6 +50,7 @@ class TestCertificateAuthority(ERP5TypeTestCase):
person
=
self
.
portal
.
person_module
.
newContent
(
portal_type
=
'Person'
,
person
=
self
.
portal
.
person_module
.
newContent
(
portal_type
=
'Person'
,
reference
=
login
,
password
=
login
)
reference
=
login
,
password
=
login
)
person
.
newContent
(
portal_type
=
'Assignment'
).
open
()
person
.
newContent
(
portal_type
=
'Assignment'
).
open
()
person
.
newContent
(
portal_type
=
'ERP5 Login'
,
reference
=
login
).
validate
()
self
.
tic
()
self
.
tic
()
return
login
return
login
...
...
product/ERP5/tests/testERP5Base.py
View file @
82235674
...
@@ -1167,14 +1167,14 @@ class TestERP5Base(ERP5TypeTestCase):
...
@@ -1167,14 +1167,14 @@ class TestERP5Base(ERP5TypeTestCase):
self
.
tic
()
self
.
tic
()
# a user is created
# a user is created
user
=
self
.
portal
.
acl_users
.
getUser
ById
(
'user_login'
)
user
=
self
.
portal
.
acl_users
.
getUser
(
'user_login'
)
self
.
assertNotEquals
(
None
,
user
)
self
.
assertNotEquals
(
None
,
user
)
# and this user has a preference created
# and this user has a preference created
newSecurityManager
(
None
,
user
.
__of__
(
self
.
portal
.
acl_users
))
newSecurityManager
(
None
,
user
.
__of__
(
self
.
portal
.
acl_users
))
self
.
assertNotEquals
(
None
,
self
.
assertNotEquals
(
None
,
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'Preference'
,
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'Preference'
,
owner
=
'user_login'
))
owner
=
user
.
getId
()
))
# for his assignent group
# for his assignent group
self
.
assertEqual
(
'group/nexedi'
,
self
.
assertEqual
(
'group/nexedi'
,
self
.
portal
.
portal_preferences
.
getPreferredSectionCategory
())
self
.
portal
.
portal_preferences
.
getPreferredSectionCategory
())
...
...
product/ERP5/tests/testERP5Commerce.py
View file @
82235674
...
@@ -227,6 +227,7 @@ class TestCommerce(ERP5TypeTestCase):
...
@@ -227,6 +227,7 @@ class TestCommerce(ERP5TypeTestCase):
start_date
=
'1972-01-01'
,
stop_date
=
'2999-12-31'
,
start_date
=
'1972-01-01'
,
stop_date
=
'2999-12-31'
,
group
=
group
,
destination_project
=
destination_project
)
group
=
group
,
destination_project
=
destination_project
)
assignment
.
open
()
assignment
.
open
()
person
.
newContent
(
portal_type
=
'ERP5 Login'
,
reference
=
reference
).
validate
()
self
.
tic
()
self
.
tic
()
#XXX: Security hack (lucas)
#XXX: Security hack (lucas)
...
...
product/ERP5/tests/testERP5Credential.py
View file @
82235674
...
@@ -303,8 +303,7 @@ class TestERP5Credential(ERP5TypeTestCase):
...
@@ -303,8 +303,7 @@ class TestERP5Credential(ERP5TypeTestCase):
self
.
portal
.
ERP5Site_activeLogin
(
mail_message
.
getReference
())
self
.
portal
.
ERP5Site_activeLogin
(
mail_message
.
getReference
())
self
.
login
()
self
.
login
()
self
.
tic
()
self
.
tic
()
person
=
portal_catalog
.
getResultValue
(
reference
=
reference
,
person
=
self
.
portal
.
acl_users
.
getUser
(
reference
).
getUserValue
()
portal_type
=
"Person"
)
assignment_list
=
person
.
objectValues
(
portal_type
=
"Assignment"
)
assignment_list
=
person
.
objectValues
(
portal_type
=
"Assignment"
)
self
.
assertEqual
(
len
(
assignment_list
),
1
)
self
.
assertEqual
(
len
(
assignment_list
),
1
)
assignment
=
assignment_list
[
0
]
assignment
=
assignment_list
[
0
]
...
@@ -380,7 +379,7 @@ class TestERP5Credential(ERP5TypeTestCase):
...
@@ -380,7 +379,7 @@ class TestERP5Credential(ERP5TypeTestCase):
last_name
=
'Simpson'
,
reference
=
'homie'
)
last_name
=
'Simpson'
,
reference
=
'homie'
)
self
.
assertEqual
(
len
(
result
),
1
)
self
.
assertEqual
(
len
(
result
),
1
)
sequence
.
edit
(
subscription_request
=
result
[
0
],
sequence
.
edit
(
subscription_request
=
result
[
0
],
perso
n_reference
=
credential_reference
)
logi
n_reference
=
credential_reference
)
def
stepAcceptSubscriptionRequest
(
self
,
sequence
=
None
,
sequence_list
=
None
,
def
stepAcceptSubscriptionRequest
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
**
kw
):
...
@@ -407,9 +406,9 @@ class TestERP5Credential(ERP5TypeTestCase):
...
@@ -407,9 +406,9 @@ class TestERP5Credential(ERP5TypeTestCase):
# check homie can log in the system
# check homie can log in the system
self
.
_assertUserExists
(
'homie'
,
'secret'
)
self
.
_assertUserExists
(
'homie'
,
'secret'
)
self
.
login
(
'homie'
)
self
.
login
ByUserName
(
'homie'
)
from
AccessControl
import
getSecurityManager
from
AccessControl
import
getSecurityManager
self
.
assertEqual
(
getSecurityManager
().
getUser
().
get
IdOr
UserName
(),
'homie'
)
self
.
assertEqual
(
getSecurityManager
().
getUser
().
getUserName
(),
'homie'
)
def
stepCreateCredentialUpdate
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
def
stepCreateCredentialUpdate
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
'''
'''
...
@@ -418,10 +417,9 @@ class TestERP5Credential(ERP5TypeTestCase):
...
@@ -418,10 +417,9 @@ class TestERP5Credential(ERP5TypeTestCase):
'''
'''
self
.
login
()
self
.
login
()
# get the 'homie' person object
# get the 'homie' person object
person_module
=
self
.
portal
.
getDefaultModule
(
'Person'
)
result
=
self
.
portal
.
portal_catalog
(
portal_type
=
'ERP5 Login'
,
reference
=
'homie'
)
result
=
person_module
.
searchFolder
(
reference
=
'homie'
)
self
.
assertEqual
(
len
(
result
),
1
)
self
.
assertEqual
(
len
(
result
),
1
)
homie
=
result
[
0
]
homie
=
result
[
0
]
.
getParentValue
()
# create a credential update
# create a credential update
credential_update_module
=
self
.
portal
.
getDefaultModule
(
\
credential_update_module
=
self
.
portal
.
getDefaultModule
(
\
...
@@ -453,9 +451,9 @@ class TestERP5Credential(ERP5TypeTestCase):
...
@@ -453,9 +451,9 @@ class TestERP5Credential(ERP5TypeTestCase):
# check that informations on the person object have been updated
# check that informations on the person object have been updated
person_module
=
self
.
portal
.
getDefaultModule
(
'Person'
)
person_module
=
self
.
portal
.
getDefaultModule
(
'Person'
)
related_
person_result
=
person_module
.
searchFolder
(
reference
=
'homie'
)
related_
login_result
=
self
.
portal
.
portal_catalog
(
portal_type
=
'ERP5 Login'
,
reference
=
'homie'
)
self
.
assertEqual
(
len
(
related_
perso
n_result
),
1
)
self
.
assertEqual
(
len
(
related_
logi
n_result
),
1
)
related_person
=
related_
person_result
[
0
]
related_person
=
related_
login_result
[
0
].
getParentValue
()
self
.
assertEqual
(
related_person
.
getLastName
(),
'Simpsons'
)
self
.
assertEqual
(
related_person
.
getLastName
(),
'Simpsons'
)
self
.
assertEqual
(
related_person
.
getDefaultEmailText
(),
self
.
assertEqual
(
related_person
.
getDefaultEmailText
(),
'homie.simpsons@fox.com'
)
'homie.simpsons@fox.com'
)
...
@@ -609,7 +607,7 @@ class TestERP5Credential(ERP5TypeTestCase):
...
@@ -609,7 +607,7 @@ class TestERP5Credential(ERP5TypeTestCase):
sequence
.
edit
(
barney
=
person
)
sequence
.
edit
(
barney
=
person
)
# check barney can log in the system
# check barney can log in the system
self
.
_assertUserExists
(
'barney-login'
,
'secret'
)
self
.
_assertUserExists
(
'barney-login'
,
'secret'
)
self
.
login
(
'barney
'
)
self
.
login
ByUserName
(
'barney-login
'
)
from
AccessControl
import
getSecurityManager
from
AccessControl
import
getSecurityManager
self
.
assertEqual
(
getSecurityManager
().
getUser
().
getIdOrUserName
(),
person
.
Person_getUserId
())
self
.
assertEqual
(
getSecurityManager
().
getUser
().
getIdOrUserName
(),
person
.
Person_getUserId
())
...
@@ -658,10 +656,10 @@ class TestERP5Credential(ERP5TypeTestCase):
...
@@ -658,10 +656,10 @@ class TestERP5Credential(ERP5TypeTestCase):
self
.
portal
.
ERP5Site_newCredentialRecovery
(
self
.
portal
.
ERP5Site_newCredentialRecovery
(
default_email_text
=
default_email_text
)
default_email_text
=
default_email_text
)
def
stepLoginAsCurrent
Perso
nReference
(
self
,
sequence
=
None
,
def
stepLoginAsCurrent
Logi
nReference
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
sequence_list
=
None
,
**
kw
):
person_reference
=
sequence
[
"perso
n_reference"
]
login_reference
=
sequence
[
"logi
n_reference"
]
self
.
login
(
perso
n_reference
)
self
.
login
ByUserName
(
logi
n_reference
)
def
stepCreateCredentialUpdateWithERP5Site_newCredentialUpdate
(
self
,
def
stepCreateCredentialUpdateWithERP5Site_newCredentialUpdate
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
...
@@ -863,8 +861,7 @@ class TestERP5Credential(ERP5TypeTestCase):
...
@@ -863,8 +861,7 @@ class TestERP5Credential(ERP5TypeTestCase):
def
stepCheckPersonAfterSubscriptionRequest
(
self
,
sequence
=
None
,
def
stepCheckPersonAfterSubscriptionRequest
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
sequence_list
=
None
,
**
kw
):
self
.
login
()
self
.
login
()
person
=
self
.
portal
.
portal_catalog
.
getResultValue
(
person
=
self
.
portal
.
acl_users
.
getUser
(
sequence
[
'login_reference'
]).
getUserValue
()
reference
=
sequence
[
"person_reference"
],
portal_type
=
"Person"
)
self
.
assertEqual
(
"Homer"
,
person
.
getFirstName
())
self
.
assertEqual
(
"Homer"
,
person
.
getFirstName
())
self
.
assertEqual
(
"Simpson"
,
person
.
getLastName
())
self
.
assertEqual
(
"Simpson"
,
person
.
getLastName
())
self
.
assertEqual
(
"homer.simpson@fox.com"
,
person
.
getDefaultEmailText
())
self
.
assertEqual
(
"homer.simpson@fox.com"
,
person
.
getDefaultEmailText
())
...
@@ -873,16 +870,14 @@ class TestERP5Credential(ERP5TypeTestCase):
...
@@ -873,16 +870,14 @@ class TestERP5Credential(ERP5TypeTestCase):
def
stepSetAuditorRoleToCurrentPerson
(
self
,
sequence
=
None
,
def
stepSetAuditorRoleToCurrentPerson
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
sequence_list
=
None
,
**
kw
):
person_reference
=
sequence
[
"person_reference"
]
self
.
login
()
self
.
login
()
person
=
self
.
portal
.
acl_users
.
getUser
(
person_reference
).
getUserValue
()
person
=
self
.
portal
.
acl_users
.
getUser
(
sequence
[
'login_reference'
]
).
getUserValue
()
person
.
manage_setLocalRoles
(
person
.
Person_getUserId
(),
[
"Auditor"
])
person
.
manage_setLocalRoles
(
person
.
Person_getUserId
(),
[
"Auditor"
])
self
.
logout
()
self
.
logout
()
def
stepCheckPersonAfterUpdatePerson
(
self
,
sequence
=
None
,
def
stepCheckPersonAfterUpdatePerson
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
sequence_list
=
None
,
**
kw
):
person
=
self
.
portal
.
portal_catalog
.
getResultValue
(
person
=
self
.
portal
.
acl_users
.
getUser
(
sequence
[
'login_reference'
]).
getUserValue
()
reference
=
sequence
[
"person_reference"
],
portal_type
=
"Person"
)
self
.
assertEqual
(
"tom"
,
person
.
getFirstName
())
self
.
assertEqual
(
"tom"
,
person
.
getFirstName
())
self
.
assertEqual
(
"Simpson"
,
person
.
getLastName
())
self
.
assertEqual
(
"Simpson"
,
person
.
getLastName
())
self
.
assertEqual
(
"tom@host.com"
,
person
.
getDefaultEmailText
())
self
.
assertEqual
(
"tom@host.com"
,
person
.
getDefaultEmailText
())
...
@@ -1123,8 +1118,7 @@ class TestERP5Credential(ERP5TypeTestCase):
...
@@ -1123,8 +1118,7 @@ class TestERP5Credential(ERP5TypeTestCase):
self.portal.ERP5Site_activeLogin(mail_message.getReference())
self.portal.ERP5Site_activeLogin(mail_message.getReference())
self.login()
self.login()
self.tic()
self.tic()
person = portal_catalog.getResultValue(reference="
barney
",
person = self.portal.acl_users.getUser('barney').getUserValue()
portal_type="
Person
")
assignment_list = person.objectValues(portal_type="
Assignment
")
assignment_list = person.objectValues(portal_type="
Assignment
")
self.assertNotEquals(assignment_list, [])
self.assertNotEquals(assignment_list, [])
self.assertEqual(len(assignment_list), 1)
self.assertEqual(len(assignment_list), 1)
...
@@ -1233,7 +1227,7 @@ class TestERP5Credential(ERP5TypeTestCase):
...
@@ -1233,7 +1227,7 @@ class TestERP5Credential(ERP5TypeTestCase):
"
stepCheckPersonAfterSubscriptionRequest
"
\
"
stepCheckPersonAfterSubscriptionRequest
"
\
"
SetAuditorRoleToCurrentPerson
"
\
"
SetAuditorRoleToCurrentPerson
"
\
"
SetAssigneeRoleToCurrentPersonInCredentialUpdateModule
Tic
"
\
"
SetAssigneeRoleToCurrentPersonInCredentialUpdateModule
Tic
"
\
"
LoginAsCurrent
Perso
nReference
"
\
"
LoginAsCurrent
Logi
nReference
"
\
"
CreateCredentialUpdateWithERP5Site_newCredentialUpdate
Tic
"
\
"
CreateCredentialUpdateWithERP5Site_newCredentialUpdate
Tic
"
\
"
SelectCredentialUpdate
"
\
"
SelectCredentialUpdate
"
\
"
AcceptCredentialUpdate
Tic
"
\
"
AcceptCredentialUpdate
Tic
"
\
...
@@ -1296,7 +1290,7 @@ class TestERP5Credential(ERP5TypeTestCase):
...
@@ -1296,7 +1290,7 @@ class TestERP5Credential(ERP5TypeTestCase):
'''
'''
sequence_list = SequenceList()
sequence_list = SequenceList()
sequence_string = "
CreatePersonWithQuestionUsingCamelCase
Tic
"
\
sequence_string = "
CreatePersonWithQuestionUsingCamelCase
Tic
"
\
"
LoginAsCurrent
Perso
nReference
"
\
"
LoginAsCurrent
Logi
nReference
"
\
"
CreateCredentialRecoveryWithSensitiveAnswer
Tic
"
\
"
CreateCredentialRecoveryWithSensitiveAnswer
Tic
"
\
"
AcceptCredentialRecovery
Tic
"
\
"
AcceptCredentialRecovery
Tic
"
\
"
CheckEmailIsSent
Tic
"
\
"
CheckEmailIsSent
Tic
"
\
...
...
product/ERP5/tests/testPasswordTool.py
View file @
82235674
This diff is collapsed.
Click to expand it.
product/ERP5/tests/testWorklist.py
View file @
82235674
...
@@ -117,6 +117,7 @@ class TestWorklist(ERP5TypeTestCase):
...
@@ -117,6 +117,7 @@ class TestWorklist(ERP5TypeTestCase):
stop_date
=
'01/01/2900'
,
stop_date
=
'01/01/2900'
,
)
)
assignment
.
open
()
assignment
.
open
()
person
.
newContent
(
portal_type
=
'ERP5 Login'
,
reference
=
user_login
).
validate
()
# Reindexing is required for the security to work
# Reindexing is required for the security to work
self
.
tic
()
self
.
tic
()
...
...
product/ERP5Banking/tests/TestERP5BankingMixin.py
View file @
82235674
...
@@ -150,6 +150,10 @@ class TestERP5BankingMixin(ERP5TypeTestCase):
...
@@ -150,6 +150,10 @@ class TestERP5BankingMixin(ERP5TypeTestCase):
# by the assignment workflow when NuxUserGroup is used and
# by the assignment workflow when NuxUserGroup is used and
# by ERP5Security PAS plugins in the context of PAS use.
# by ERP5Security PAS plugins in the context of PAS use.
assignment
.
open
()
assignment
.
open
()
person
.
newContent
(
portal_type
=
'ERP5 Login'
,
reference
=
user_login
,
).
validate
()
if
self
.
PAS_installed
:
if
self
.
PAS_installed
:
# reindexing is required for the security to work
# reindexing is required for the security to work
...
...
product/ERP5Catalog/tests/testERP5CatalogSecurityUidOptimization.py
View file @
82235674
...
@@ -128,6 +128,7 @@ CREATE TABLE alternate_roles_and_users (
...
@@ -128,6 +128,7 @@ CREATE TABLE alternate_roles_and_users (
reference
=
'user1'
)
reference
=
'user1'
)
user1_id
=
user1
.
Person_getUserId
()
user1_id
=
user1
.
Person_getUserId
()
user1
.
newContent
(
portal_type
=
'Assignment'
,
group
=
'g1'
).
open
()
user1
.
newContent
(
portal_type
=
'Assignment'
,
group
=
'g1'
).
open
()
user1
.
newContent
(
portal_type
=
'ERP5 Login'
,
reference
=
'user1'
).
validate
()
user1
.
updateLocalRolesOnSecurityGroups
()
user1
.
updateLocalRolesOnSecurityGroups
()
self
.
assertEqual
(
user1
.
__ac_local_roles__
.
get
(
user1_id
),
[
'Auditor'
])
self
.
assertEqual
(
user1
.
__ac_local_roles__
.
get
(
user1_id
),
[
'Auditor'
])
self
.
assertEqual
(
user1
.
__ac_local_roles__
.
get
(
'GROUP1'
),
[
'Unknown'
])
self
.
assertEqual
(
user1
.
__ac_local_roles__
.
get
(
'GROUP1'
),
[
'Unknown'
])
...
@@ -136,6 +137,7 @@ CREATE TABLE alternate_roles_and_users (
...
@@ -136,6 +137,7 @@ CREATE TABLE alternate_roles_and_users (
reference
=
'user2'
)
reference
=
'user2'
)
user2_id
=
user2
.
Person_getUserId
()
user2_id
=
user2
.
Person_getUserId
()
user2
.
newContent
(
portal_type
=
'Assignment'
,
group
=
'g1'
).
open
()
user2
.
newContent
(
portal_type
=
'Assignment'
,
group
=
'g1'
).
open
()
user2
.
newContent
(
portal_type
=
'ERP5 Login'
,
reference
=
'user2'
).
validate
()
user2
.
updateLocalRolesOnSecurityGroups
()
user2
.
updateLocalRolesOnSecurityGroups
()
self
.
assertEqual
(
user2
.
__ac_local_roles__
.
get
(
user2_id
),
[
'Auditor'
])
self
.
assertEqual
(
user2
.
__ac_local_roles__
.
get
(
user2_id
),
[
'Auditor'
])
self
.
assertEqual
(
user2
.
__ac_local_roles__
.
get
(
'GROUP1'
),
[
'Unknown'
])
self
.
assertEqual
(
user2
.
__ac_local_roles__
.
get
(
'GROUP1'
),
[
'Unknown'
])
...
...
product/ERP5Form/tests/testGUIwithSecurity.py
View file @
82235674
...
@@ -72,6 +72,7 @@ class TestGUISecurity(ERP5TypeTestCase):
...
@@ -72,6 +72,7 @@ class TestGUISecurity(ERP5TypeTestCase):
self
.
assertTrue
(
'Created Successfully'
in
message
)
self
.
assertTrue
(
'Created Successfully'
in
message
)
if
not
hasattr
(
portal
.
person_module
,
'user'
):
if
not
hasattr
(
portal
.
person_module
,
'user'
):
user
=
portal
.
person_module
.
newContent
(
portal_type
=
'Person'
,
id
=
'user'
,
reference
=
'user'
)
user
=
portal
.
person_module
.
newContent
(
portal_type
=
'Person'
,
id
=
'user'
,
reference
=
'user'
)
user
.
newContent
(
portal_type
=
'ERP5 Login'
,
reference
=
'user'
).
validate
()
asg
=
user
.
newContent
(
portal_type
=
'Assignment'
)
asg
=
user
.
newContent
(
portal_type
=
'Assignment'
)
asg
.
setStartDate
(
DateTime
()
-
100
)
asg
.
setStartDate
(
DateTime
()
-
100
)
asg
.
setStopDate
(
DateTime
()
+
100
)
asg
.
setStopDate
(
DateTime
()
+
100
)
...
...
product/ERP5OOo/tests/testDeferredStyle.py
View file @
82235674
...
@@ -64,10 +64,15 @@ class TestDeferredStyle(ERP5TypeTestCase, ZopeTestCase.Functional):
...
@@ -64,10 +64,15 @@ class TestDeferredStyle(ERP5TypeTestCase, ZopeTestCase.Functional):
person
=
person_module
.
newContent
(
id
=
'pers'
,
portal_type
=
'Person'
,
person
=
person_module
.
newContent
(
id
=
'pers'
,
portal_type
=
'Person'
,
reference
=
self
.
username
,
reference
=
self
.
username
,
first_name
=
self
.
first_name
,
first_name
=
self
.
first_name
,
password
=
self
.
password
,
default_email_text
=
self
.
recipient_email_address
)
default_email_text
=
self
.
recipient_email_address
)
assignment
=
person
.
newContent
(
portal_type
=
'Assignment'
)
assignment
=
person
.
newContent
(
portal_type
=
'Assignment'
)
assignment
.
open
()
assignment
.
open
()
login
=
person
.
newContent
(
portal_type
=
'ERP5 Login'
,
reference
=
self
.
username
,
password
=
self
.
password
,
)
login
.
validate
()
self
.
tic
()
self
.
tic
()
def
loginAsUser
(
self
,
username
):
def
loginAsUser
(
self
,
username
):
...
...
product/ERP5Security/tests/testERP5Security.py
View file @
82235674
This diff is collapsed.
Click to expand it.
product/ERP5Type/tests/ERP5TypeTestCase.py
View file @
82235674
...
@@ -471,8 +471,11 @@ class ERP5TypeTestCaseMixin(ProcessingNodeTestCase, PortalTestCase):
...
@@ -471,8 +471,11 @@ class ERP5TypeTestCaseMixin(ProcessingNodeTestCase, PortalTestCase):
person
=
self
.
portal
.
person_module
.
newContent
(
portal_type
=
'Person'
,
person
=
self
.
portal
.
person_module
.
newContent
(
portal_type
=
'Person'
,
reference
=
reference
,
reference
=
reference
,
password
=
password
,
**
person_kw
)
**
person_kw
)
login
=
person
.
newContent
(
portal_type
=
'ERP5 Login'
,
reference
=
reference
,
password
=
password
)
login
.
validate
()
return
person
return
person
def
createUserAssignment
(
self
,
user
,
assignment_kw
):
def
createUserAssignment
(
self
,
user
,
assignment_kw
):
...
...
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