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
Binh
erp5
Commits
b346c6b5
Commit
b346c6b5
authored
Jun 29, 2011
by
Yusei Tahara
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://git.erp5.org/repos/erp5
parents
705330b5
c82ae4ad
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
14 deletions
+17
-14
product/ERP5/tests/testERP5Credential.py
product/ERP5/tests/testERP5Credential.py
+17
-14
No files found.
product/ERP5/tests/testERP5Credential.py
View file @
b346c6b5
...
...
@@ -25,6 +25,7 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
import
unittest
from
Products.ERP5Type.tests.utils
import
reindex
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
...
...
@@ -46,6 +47,7 @@ if use_verbose_security:
authenticated
=
True
,
verbose
=
True
)
class
TestERP5Credential
(
ERP5TypeTestCase
):
def
getTitle
(
self
):
...
...
@@ -92,7 +94,7 @@ class TestERP5Credential(ERP5TypeTestCase):
def
createCategories
(
self
):
"""Create the categories for our test. """
# create categories
for
cat_string
in
self
.
getNeededCategoryList
()
:
for
cat_string
in
self
.
getNeededCategoryList
():
base_cat
=
cat_string
.
split
(
"/"
)[
0
]
# if base_cat not exist, create it
if
getattr
(
self
.
getPortal
().
portal_categories
,
base_cat
,
None
)
==
None
:
...
...
@@ -100,8 +102,8 @@ class TestERP5Credential(ERP5TypeTestCase):
portal_type
=
'Base Category'
,
id
=
base_cat
)
base_cat_value
=
self
.
getPortal
().
portal_categories
[
base_cat
]
for
cat
in
cat_string
.
split
(
"/"
)[
1
:]
:
if
not
cat
in
base_cat_value
.
objectIds
()
:
for
cat
in
cat_string
.
split
(
"/"
)[
1
:]:
if
not
cat
in
base_cat_value
.
objectIds
():
base_cat_value
=
base_cat_value
.
newContent
(
portal_type
=
'Category'
,
id
=
cat
,
...
...
@@ -109,7 +111,7 @@ class TestERP5Credential(ERP5TypeTestCase):
else
:
base_cat_value
=
base_cat_value
[
cat
]
# check categories have been created
for
cat_string
in
self
.
getNeededCategoryList
()
:
for
cat_string
in
self
.
getNeededCategoryList
():
self
.
assertNotEquals
(
None
,
self
.
getCategoryTool
().
restrictedTraverse
(
cat_string
),
cat_string
)
...
...
@@ -255,8 +257,8 @@ class TestERP5Credential(ERP5TypeTestCase):
self
.
stepTic
()
self
.
logout
()
def
stepSetOrganisationCredentialUpdateAutomaticApprovalPreferences
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
def
stepSetOrganisationCredentialUpdateAutomaticApprovalPreferences
(
self
,
sequence
=
None
,
sequence
_list
=
None
,
**
kw
):
self
.
login
()
preference
=
self
.
_getPreference
()
preference
.
edit
(
preferred_organisation_credential_update_automatic_approval
=
True
)
...
...
@@ -290,8 +292,8 @@ class TestERP5Credential(ERP5TypeTestCase):
reference
=
sequence
[
"reference"
]
assignment_function
=
sequence
[
"assignment_function"
]
assignment_role
=
sequence
[
"assignment_role"
]
credential_request
=
portal_catalog
.
getResultValue
(
portal_type
=
"Credential Request"
,
reference
=
reference
)
credential_request
=
portal_catalog
.
getResultValue
(
portal_type
=
"Credential Request"
,
reference
=
reference
)
mail_message
=
portal_catalog
.
getResultValue
(
portal_type
=
"Mail Message"
,
follow_up
=
credential_request
)
self
.
stepTic
()
...
...
@@ -320,9 +322,9 @@ class TestERP5Credential(ERP5TypeTestCase):
uf
=
self
.
getUserFolder
()
self
.
assertNotEquals
(
uf
.
getUserById
(
login
,
None
),
None
)
for
plugin_name
,
plugin
in
uf
.
_getOb
(
'plugins'
).
listPlugins
(
IAuthenticationPlugin
):
IAuthenticationPlugin
):
if
plugin
.
authenticateCredentials
(
{
'login'
:
login
,
'password'
:
password
})
is
not
None
:
{
'login'
:
login
,
'password'
:
password
})
is
not
None
:
break
else
:
self
.
fail
(
"No plugin could authenticate '%s' with password '%s'"
%
...
...
@@ -336,9 +338,9 @@ class TestERP5Credential(ERP5TypeTestCase):
IAuthenticationPlugin
uf
=
self
.
getUserFolder
()
for
plugin_name
,
plugin
in
uf
.
_getOb
(
'plugins'
).
listPlugins
(
IAuthenticationPlugin
):
IAuthenticationPlugin
):
if
plugin
.
authenticateCredentials
(
{
'login'
:
login
,
'password'
:
password
})
is
not
None
:
{
'login'
:
login
,
'password'
:
password
})
is
not
None
:
self
.
fail
(
"Plugin %s should not have authenticated '%s' with password '%s'"
%
(
plugin_name
,
login
,
password
))
...
...
@@ -726,7 +728,7 @@ class TestERP5Credential(ERP5TypeTestCase):
mail_message
=
portal_catalog
.
getResultValue
(
portal_type
=
"Mail Message"
,
follow_up
=
credential_reference
)
self
.
assertEquals
(
mail_message
.
getSimulationState
(),
"started"
)
self
.
assertTrue
(
"key=%s"
%
mail_message
.
getReference
()
in
mail_message
.
getTextContent
())
self
.
assertTrue
(
"key=%s"
%
mail_message
.
getReference
()
in
mail_message
.
getTextContent
())
def
stepSetPreferredCredentialAlarmAutomaticCallAsFalse
(
self
,
sequence
):
sequence
.
edit
(
automatic_call
=
False
)
...
...
@@ -1010,6 +1012,7 @@ class TestERP5Credential(ERP5TypeTestCase):
enought to reset his passord
'''
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestERP5Credential))
...
...
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