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
1
Merge Requests
1
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
Boxiang Sun
erp5
Commits
55cd18ec
Commit
55cd18ec
authored
Jan 26, 2012
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master' into lazy_simulation_causality
parents
8982ecde
b3c18ce8
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
349 additions
and
320 deletions
+349
-320
CHANGES.erp5.util.txt
CHANGES.erp5.util.txt
+1
-1
bt5/erp5_run_my_doc/PortalTypeTemplateItem/portal_types/Test%20Page.xml
...y_doc/PortalTypeTemplateItem/portal_types/Test%20Page.xml
+1
-0
bt5/erp5_run_my_doc/SkinTemplateItem/portal_skins/erp5_run_my_doc/TestPageModule_convertPage.xml
...rtal_skins/erp5_run_my_doc/TestPageModule_convertPage.xml
+15
-12
bt5/erp5_run_my_doc/SkinTemplateItem/portal_skins/erp5_run_my_doc/TestPageModule_convertToTestPage.xml
...kins/erp5_run_my_doc/TestPageModule_convertToTestPage.xml
+2
-2
bt5/erp5_run_my_doc/SkinTemplateItem/portal_skins/erp5_run_my_doc/TestPageModule_convertToWebPage.xml
...skins/erp5_run_my_doc/TestPageModule_convertToWebPage.xml
+2
-2
bt5/erp5_run_my_doc/SkinTemplateItem/portal_skins/erp5_run_my_doc/TestPageModule_listWebPages.xml
...tal_skins/erp5_run_my_doc/TestPageModule_listWebPages.xml
+0
-75
bt5/erp5_run_my_doc/SkinTemplateItem/portal_skins/erp5_run_my_doc/TestPageModule_viewConvertToTestPagesDialog.xml
...un_my_doc/TestPageModule_viewConvertToTestPagesDialog.xml
+1
-1
bt5/erp5_run_my_doc/SkinTemplateItem/portal_skins/erp5_run_my_doc/TestPageModule_viewConvertToTestPagesDialog/listbox.xml
...c/TestPageModule_viewConvertToTestPagesDialog/listbox.xml
+50
-22
bt5/erp5_run_my_doc/SkinTemplateItem/portal_skins/erp5_run_my_doc/TestPageModule_viewConvertToWebPagesDialog.xml
...run_my_doc/TestPageModule_viewConvertToWebPagesDialog.xml
+1
-1
bt5/erp5_run_my_doc/TestTemplateItem/testRunMyDoc.py
bt5/erp5_run_my_doc/TestTemplateItem/testRunMyDoc.py
+90
-0
bt5/erp5_run_my_doc/bt/revision
bt5/erp5_run_my_doc/bt/revision
+1
-1
bt5/erp5_run_my_doc/bt/template_test_id_list
bt5/erp5_run_my_doc/bt/template_test_id_list
+1
-0
product/ERP5/tests/testERP5Web.py
product/ERP5/tests/testERP5Web.py
+178
-200
setup.py
setup.py
+6
-3
No files found.
CHANGES.erp5.util.txt
View file @
55cd18ec
...
@@ -38,5 +38,5 @@ Changes
...
@@ -38,5 +38,5 @@ Changes
0.1 (2011-08-08)
0.1 (2011-08-08)
----------------
----------------
* erp5.util.testnode imported from recipe
like slapos.cookbook
* erp5.util.testnode imported from recipe
-
like slapos.cookbook
[Łukasz Nowak]
[Łukasz Nowak]
bt5/erp5_run_my_doc/PortalTypeTemplateItem/portal_types/Test%20Page.xml
View file @
55cd18ec
...
@@ -43,6 +43,7 @@
...
@@ -43,6 +43,7 @@
<key>
<string>
group_list
</string>
</key>
<key>
<string>
group_list
</string>
</key>
<value>
<value>
<tuple>
<tuple>
<string>
document
</string>
<string>
my_document
</string>
<string>
my_document
</string>
<string>
recent_document
</string>
<string>
recent_document
</string>
<string>
web_document
</string>
<string>
web_document
</string>
...
...
bt5/erp5_run_my_doc/SkinTemplateItem/portal_skins/erp5_run_my_doc/TestPageModule_convertPage
s
.xml
→
bt5/erp5_run_my_doc/SkinTemplateItem/portal_skins/erp5_run_my_doc/TestPageModule_convertPage.xml
View file @
55cd18ec
...
@@ -50,15 +50,19 @@
...
@@ -50,15 +50,19 @@
</item>
</item>
<item>
<item>
<key>
<string>
_body
</string>
</key>
<key>
<string>
_body
</string>
</key>
<value>
<string>
if conv_obj_type == \'Web Page\':\n
<value>
<string>
# XXX (rafael) I beleave KM has a much better way to do this, \n
conv_module_path = \'/erp5/web_page_module\'\n
# clone web page.\n
else:\n
\n
conv_module_path = \'/erp5/test_page_module\'\n
conv_module_id = \'test_page_module\'\n
conv_obj_module = context.restrictedTraverse(conv_module_path)\n
\n
if conv_obj_type == \'Web Page\':\n
conv_module_id = \'web_page_module\'\n
\n
conv_obj_module = context.getDefaultModule(conv_obj_type)\n
counter = 0\n
counter = 0\n
for uid in uids:\n
for uid in uids:\n
counter += 1\n
counter += 1\n
obj = context.portal_catalog
(uid=uid)[0]
\n
obj = context.portal_catalog
.getResultValue(uid=uid)
\n
conv_obj = conv_obj_module.newContent(portal_type = conv_obj_type,\n
conv_obj = conv_obj_module.newContent(portal_type = conv_obj_type,\n
title = obj.getTitle(),\n
title = obj.getTitle(),\n
short_title = obj.getShortTitle(),\n
short_title = obj.getShortTitle(),\n
...
@@ -72,11 +76,10 @@ for uid in uids:\n
...
@@ -72,11 +76,10 @@ for uid in uids:\n
text_content = obj.getTextContent(),\n
text_content = obj.getTextContent(),\n
format = obj.getFormat(),\n
format = obj.getFormat(),\n
contributor_list = obj.getContributorList())\n
contributor_list = obj.getContributorList())\n
try:\n
\n
context.restrictedTraverse(conv_module_path)\n
conv_obj = conv_obj.manage_pasteObjects(\n
except:\n
obj.manage_copyObjects(\n
conv_obj.setId(obj.getId())\n
map(lambda x: x.getId(), obj.objectValues())))\n
conv_obj = conv_obj.manage_pasteObjects(obj.manage_copyObjects(map(lambda x: x.getId(), obj.objectValues())))\n
\n
\n
return conv_obj_module.Base_redirect(\'\', dict(portal_status_message=context.Base_translateString(str(counter) + " object(s) converted.")))\n
return conv_obj_module.Base_redirect(\'\', dict(portal_status_message=context.Base_translateString(str(counter) + " object(s) converted.")))\n
</string>
</value>
</string>
</value>
...
@@ -87,7 +90,7 @@ return conv_obj_module.Base_redirect(\'\', dict(portal_status_message=context.Ba
...
@@ -87,7 +90,7 @@ return conv_obj_module.Base_redirect(\'\', dict(portal_status_message=context.Ba
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
<value>
<string>
TestPageModule_convertPage
s
</string>
</value>
<value>
<string>
TestPageModule_convertPage
</string>
</value>
</item>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
...
...
bt5/erp5_run_my_doc/SkinTemplateItem/portal_skins/erp5_run_my_doc/TestPageModule_convertTo
WebPages
.xml
→
bt5/erp5_run_my_doc/SkinTemplateItem/portal_skins/erp5_run_my_doc/TestPageModule_convertTo
TestPage
.xml
View file @
55cd18ec
...
@@ -50,7 +50,7 @@
...
@@ -50,7 +50,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
_body
</string>
</key>
<key>
<string>
_body
</string>
</key>
<value>
<string>
return context.TestPageModule_convertPage
s(uids, \'Web
Page\')\n
<value>
<string>
return context.TestPageModule_convertPage
(uids, \'Test
Page\')\n
</string>
</value>
</string>
</value>
</item>
</item>
<item>
<item>
...
@@ -59,7 +59,7 @@
...
@@ -59,7 +59,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
<value>
<string>
TestPageModule_convertTo
WebPages
</string>
</value>
<value>
<string>
TestPageModule_convertTo
TestPage
</string>
</value>
</item>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
...
...
bt5/erp5_run_my_doc/SkinTemplateItem/portal_skins/erp5_run_my_doc/TestPageModule_convertTo
TestPages
.xml
→
bt5/erp5_run_my_doc/SkinTemplateItem/portal_skins/erp5_run_my_doc/TestPageModule_convertTo
WebPage
.xml
View file @
55cd18ec
...
@@ -50,7 +50,7 @@
...
@@ -50,7 +50,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
_body
</string>
</key>
<key>
<string>
_body
</string>
</key>
<value>
<string>
return context.TestPageModule_convertPage
s(uids, \'Test
Page\')\n
<value>
<string>
return context.TestPageModule_convertPage
(uids, \'Web
Page\')\n
</string>
</value>
</string>
</value>
</item>
</item>
<item>
<item>
...
@@ -59,7 +59,7 @@
...
@@ -59,7 +59,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
<value>
<string>
TestPageModule_convertTo
TestPages
</string>
</value>
<value>
<string>
TestPageModule_convertTo
WebPage
</string>
</value>
</item>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
...
...
bt5/erp5_run_my_doc/SkinTemplateItem/portal_skins/erp5_run_my_doc/TestPageModule_listWebPages.xml
deleted
100644 → 0
View file @
8982ecde
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
"""\n
Fetches Web Pages from the Web Page Module\n
"""\n
element_list = context.restrictedTraverse(\'/erp5/web_page_module\').objectValues()\n
\n
for sorted_element in sort_on:\n
element_list = sorted(element_list, key = lambda x: x.getProperty(sorted_element[0]), reverse = sorted_element[1] == \'descending\')\n
\n
return element_list\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
sort_on = [], **kw
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
TestPageModule_listWebPages
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_run_my_doc/SkinTemplateItem/portal_skins/erp5_run_my_doc/TestPageModule_viewConvertToTestPagesDialog.xml
View file @
55cd18ec
...
@@ -35,7 +35,7 @@
...
@@ -35,7 +35,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
action
</string>
</key>
<key>
<string>
action
</string>
</key>
<value>
<string>
TestPageModule_convertToTestPage
s
</string>
</value>
<value>
<string>
TestPageModule_convertToTestPage
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
description
</string>
</key>
<key>
<string>
description
</string>
</key>
...
...
bt5/erp5_run_my_doc/SkinTemplateItem/portal_skins/erp5_run_my_doc/TestPageModule_viewConvertToTestPagesDialog/listbox.xml
View file @
55cd18ec
...
@@ -15,10 +15,12 @@
...
@@ -15,10 +15,12 @@
<string>
count_method
</string>
<string>
count_method
</string>
<string>
domain_root_list
</string>
<string>
domain_root_list
</string>
<string>
domain_tree
</string>
<string>
domain_tree
</string>
<string>
editable_columns
</string>
<string>
lines
</string>
<string>
lines
</string>
<string>
list_method
</string>
<string>
list_method
</string>
<string>
portal_types
</string>
<string>
selection_name
</string>
<string>
selection_name
</string>
<string>
sort
</string>
<string>
sort_columns
</string>
<string>
title
</string>
<string>
title
</string>
</list>
</list>
</value>
</value>
...
@@ -167,10 +169,6 @@
...
@@ -167,10 +169,6 @@
<string>
language
</string>
<string>
language
</string>
<string>
Language
</string>
<string>
Language
</string>
</tuple>
</tuple>
<tuple>
<string>
int_index
</string>
<string>
Index
</string>
</tuple>
<tuple>
<tuple>
<string>
translated_validation_state_title
</string>
<string>
translated_validation_state_title
</string>
<string>
State
</string>
<string>
State
</string>
...
@@ -197,21 +195,6 @@
...
@@ -197,21 +195,6 @@
<key>
<string>
domain_tree
</string>
</key>
<key>
<string>
domain_tree
</string>
</key>
<value>
<int>
1
</int>
</value>
<value>
<int>
1
</int>
</value>
</item>
</item>
<item>
<key>
<string>
editable_columns
</string>
</key>
<value>
<list>
<tuple>
<string>
creation_date
</string>
<string>
Creation Date
</string>
</tuple>
<tuple>
<string>
modification_date
</string>
<string>
Modification Date
</string>
</tuple>
</list>
</value>
</item>
<item>
<item>
<key>
<string>
field_id
</string>
</key>
<key>
<string>
field_id
</string>
</key>
<value>
<string>
my_list_mode_listbox
</string>
</value>
<value>
<string>
my_list_mode_listbox
</string>
</value>
...
@@ -230,9 +213,54 @@
...
@@ -230,9 +213,54 @@
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
portal_types
</string>
</key>
<value>
<list>
<tuple>
<string>
Web Page
</string>
<string>
Web Page
</string>
</tuple>
</list>
</value>
</item>
<item>
<item>
<key>
<string>
selection_name
</string>
</key>
<key>
<string>
selection_name
</string>
</key>
<value>
<string>
web_page_module_view_web_page_list_selection
</string>
</value>
<value>
<string>
test_page_view_web_page_list_selection
</string>
</value>
</item>
<item>
<key>
<string>
sort
</string>
</key>
<value>
<list>
<tuple>
<string>
id
</string>
<string>
ID
</string>
</tuple>
</list>
</value>
</item>
<item>
<key>
<string>
sort_columns
</string>
</key>
<value>
<list>
<tuple>
<string>
id
</string>
<string>
ID
</string>
</tuple>
<tuple>
<string>
reference
</string>
<string>
Reference
</string>
</tuple>
<tuple>
<string>
short_title
</string>
<string>
Short Title
</string>
</tuple>
<tuple>
<string>
title
</string>
<string>
Long Title
</string>
</tuple>
</list>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
target
</string>
</key>
<key>
<string>
target
</string>
</key>
...
@@ -256,7 +284,7 @@
...
@@ -256,7 +284,7 @@
<dictionary>
<dictionary>
<item>
<item>
<key>
<string>
method_name
</string>
</key>
<key>
<string>
method_name
</string>
</key>
<value>
<string>
TestPageModule_listWebPages
</string>
</value>
<value>
<string>
portal_catalog
</string>
</value>
</item>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
...
...
bt5/erp5_run_my_doc/SkinTemplateItem/portal_skins/erp5_run_my_doc/TestPageModule_viewConvertToWebPagesDialog.xml
View file @
55cd18ec
...
@@ -35,7 +35,7 @@
...
@@ -35,7 +35,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
action
</string>
</key>
<key>
<string>
action
</string>
</key>
<value>
<string>
TestPageModule_convertToWebPage
s
</string>
</value>
<value>
<string>
TestPageModule_convertToWebPage
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
description
</string>
</key>
<key>
<string>
description
</string>
</key>
...
...
bt5/erp5_run_my_doc/TestTemplateItem/testRunMyDoc.py
0 → 100644
View file @
55cd18ec
##############################################################################
#
# Copyright (c) 2002-2012 Nexedi SA and Contributors. All Rights Reserved.
# Rafael Monnerat <rafael@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
##############################################################################
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
class
TestRunMyDoc
(
ERP5TypeTestCase
):
"""
Basic Test for internal implementation of RunMyDocs
"""
def
getTitle
(
self
):
return
"Run My Doc"
def
getBusinessTemplateList
(
self
):
"""
Tuple of Business Templates we need to install
"""
# Include all list here.
return
[
'erp5_base'
'erp5_jquery'
'erp5_jquery_ui'
'erp5_knowledge_pad'
'erp5_web'
'erp5_dms'
'erp5_slideshow_style'
'erp5_ui_test_core'
,
'erp5_run_my_doc'
]
def
afterSetUp
(
self
):
"""
This is ran before anything, used to set the environment
"""
# here, you can create the categories and objects your test will depend on
pass
website_id
=
"test_page_web_site"
def
test_getDocumentListWithTestPage
(
self
):
"""
Assert if Test Page works with getDocumentList
"""
test_page_reference
=
"developer-my.test.page"
website
=
getattr
(
self
.
portal
.
web_site_module
,
self
.
website_id
,
None
)
if
website
is
None
:
website
=
self
.
portal
.
web_site_module
.
newContent
(
portal_type
=
'Web Site'
,
id
=
self
.
website_id
)
website
.
publish
()
self
.
stepTic
()
test_page
=
self
.
portal
.
test_page_module
.
newContent
(
portal_type
=
"Test Page"
,
reference
=
test_page_reference
,
language
=
"en"
,
version
=
"001"
)
test_page
.
publish
()
self
.
stepTic
()
document
=
website
.
WebSection_getDocumentValue
(
test_page_reference
)
self
.
assertNotEquals
(
None
,
document
)
self
.
assertEquals
(
document
.
getRelativeUrl
(),
test_page
.
getRelativeUrl
())
\ No newline at end of file
bt5/erp5_run_my_doc/bt/revision
View file @
55cd18ec
6
9
\ No newline at end of file
\ No newline at end of file
bt5/erp5_run_my_doc/bt/template_test_id_list
0 → 100644
View file @
55cd18ec
testRunMyDoc
\ No newline at end of file
product/ERP5/tests/testERP5Web.py
View file @
55cd18ec
...
@@ -32,8 +32,6 @@ import re
...
@@ -32,8 +32,6 @@ import re
import
unittest
import
unittest
import
transaction
import
transaction
from
AccessControl
import
Unauthorized
from
AccessControl
import
Unauthorized
from
AccessControl.SecurityManagement
import
newSecurityManager
from
AccessControl.SecurityManagement
import
getSecurityManager
from
Testing
import
ZopeTestCase
from
Testing
import
ZopeTestCase
from
Products.ERP5Type.TransactionalVariable
import
getTransactionalVariable
from
Products.ERP5Type.TransactionalVariable
import
getTransactionalVariable
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
...
@@ -41,18 +39,19 @@ from Products.ERP5Type.tests.utils import DummyLocalizer
...
@@ -41,18 +39,19 @@ from Products.ERP5Type.tests.utils import DummyLocalizer
from
Products.ERP5Type.tests.utils
import
createZODBPythonScript
from
Products.ERP5Type.tests.utils
import
createZODBPythonScript
from
Products.ERP5Type.tests.backportUnittest
import
expectedFailure
from
Products.ERP5Type.tests.backportUnittest
import
expectedFailure
LANGUAGE_LIST
=
(
'en'
,
'fr'
,
'de'
,
'bg'
,)
LANGUAGE_LIST
=
(
'en'
,
'fr'
,
'de'
,
'bg'
,
)
HTTP_OK
=
200
HTTP_OK
=
200
MOVED_TEMPORARILY
=
302
MOVED_TEMPORARILY
=
302
class
TestERP5Web
(
ERP5TypeTestCase
):
class
TestERP5Web
(
ERP5TypeTestCase
):
"""Test for erp5_web business template.
"""Test for erp5_web business template.
"""
"""
manager_username
=
'zope'
manager_username
=
'zope'
manager_password
=
'zope'
manager_password
=
'zope'
website_id
=
'test'
website_id
=
'test'
credential
=
'%s:%s'
%
(
manager_username
,
manager_password
)
credential
=
'%s:%s'
%
(
manager_username
,
manager_password
)
def
getTitle
(
self
):
def
getTitle
(
self
):
return
"ERP5Web"
return
"ERP5Web"
...
@@ -70,12 +69,14 @@ class TestERP5Web(ERP5TypeTestCase):
...
@@ -70,12 +69,14 @@ class TestERP5Web(ERP5TypeTestCase):
portal
=
self
.
getPortal
()
portal
=
self
.
getPortal
()
uf
=
portal
.
acl_users
uf
=
portal
.
acl_users
uf
.
_doAddUser
(
self
.
manager_username
,
self
.
manager_password
,
[
'Manager'
],
[])
uf
.
_doAddUser
(
self
.
manager_username
,
self
.
manager_password
,
[
'Manager'
],
[])
self
.
login
(
self
.
manager_username
)
self
.
login
(
self
.
manager_username
)
self
.
web_page_module
=
self
.
portal
.
getDefaultModule
(
'Web Page Module'
)
self
.
web_page_module
=
self
.
portal
.
getDefaultModule
(
'Web Page Module'
)
self
.
web_site_module
=
self
.
portal
.
getDefaultModule
(
'Web Site Module'
)
self
.
web_site_module
=
self
.
portal
.
getDefaultModule
(
'Web Site Module'
)
portal
.
Localizer
.
manage_changeDefaultLang
(
language
=
'en'
)
portal
.
Localizer
.
manage_changeDefaultLang
(
language
=
'en'
)
self
.
portal_id
=
self
.
portal
.
getId
()
self
.
portal_id
=
self
.
portal
.
getId
()
def
clearModule
(
self
,
module
):
def
clearModule
(
self
,
module
):
...
@@ -93,19 +94,18 @@ class TestERP5Web(ERP5TypeTestCase):
...
@@ -93,19 +94,18 @@ class TestERP5Web(ERP5TypeTestCase):
Setup Web Site
Setup Web Site
"""
"""
portal
=
self
.
getPortal
()
portal
=
self
.
getPortal
()
request
=
self
.
app
.
REQUEST
# add supported languages for Localizer
# add supported languages for Localizer
localizer
=
portal
.
Localizer
localizer
=
portal
.
Localizer
for
language
in
LANGUAGE_LIST
:
for
language
in
LANGUAGE_LIST
:
localizer
.
manage_addLanguage
(
language
=
language
)
localizer
.
manage_addLanguage
(
language
=
language
)
# create website
# create website
if
hasattr
(
self
.
web_site_module
,
self
.
website_id
):
if
hasattr
(
self
.
web_site_module
,
self
.
website_id
):
self
.
web_site_module
.
manage_delObjects
(
self
.
website_id
)
self
.
web_site_module
.
manage_delObjects
(
self
.
website_id
)
website
=
self
.
getPortal
().
web_site_module
.
newContent
(
portal_type
=
'Web Site'
,
website
=
self
.
web_site_module
.
newContent
(
portal_type
=
'Web Site'
,
id
=
self
.
website_id
,
id
=
self
.
website_id
,
**
kw
)
**
kw
)
website
.
publish
()
website
.
publish
()
self
.
stepTic
()
self
.
stepTic
()
return
website
return
website
...
@@ -114,11 +114,10 @@ class TestERP5Web(ERP5TypeTestCase):
...
@@ -114,11 +114,10 @@ class TestERP5Web(ERP5TypeTestCase):
"""
"""
Setup Web Section
Setup Web Section
"""
"""
web_site_module
=
self
.
portal
.
getDefaultModule
(
'Web Site'
)
website
=
self
.
web_site_module
[
self
.
website_id
]
website
=
web_site_module
[
self
.
website_id
]
websection
=
website
.
newContent
(
portal_type
=
'Web Section'
,
**
kw
)
websection
=
website
.
newContent
(
portal_type
=
'Web Section'
,
**
kw
)
self
.
websection
=
websection
self
.
websection
=
websection
kw
=
dict
(
criterion_property_list
=
'portal_type'
,
kw
=
dict
(
criterion_property_list
=
'portal_type'
,
membership_criterion_base_category_list
=
''
,
membership_criterion_base_category_list
=
''
,
membership_criterion_category_list
=
''
)
membership_criterion_category_list
=
''
)
websection
.
edit
(
**
kw
)
websection
.
edit
(
**
kw
)
...
@@ -136,11 +135,6 @@ class TestERP5Web(ERP5TypeTestCase):
...
@@ -136,11 +135,6 @@ class TestERP5Web(ERP5TypeTestCase):
Setup some Web Pages.
Setup some Web Pages.
"""
"""
webpage_list
=
[]
webpage_list
=
[]
portal
=
self
.
getPortal
()
request
=
self
.
app
.
REQUEST
web_site_module
=
self
.
portal
.
getDefaultModule
(
'Web Site'
)
website
=
web_site_module
[
self
.
website_id
]
# create sample web pages
# create sample web pages
for
language
in
language_list
:
for
language
in
language_list
:
if
suffix
is
not
None
:
if
suffix
is
not
None
:
...
@@ -167,9 +161,7 @@ class TestERP5Web(ERP5TypeTestCase):
...
@@ -167,9 +161,7 @@ class TestERP5Web(ERP5TypeTestCase):
Test that a recataloging works for Web Site documents
Test that a recataloging works for Web Site documents
"""
"""
self
.
setupWebSite
()
self
.
setupWebSite
()
portal
=
self
.
getPortal
()
web_site
=
self
.
web_site_module
[
self
.
website_id
]
web_site_module
=
self
.
portal
.
getDefaultModule
(
'Web Site'
)
web_site
=
web_site_module
[
self
.
website_id
]
self
.
assertTrue
(
web_site
is
not
None
)
self
.
assertTrue
(
web_site
is
not
None
)
# Recatalog the Web Site document
# Recatalog the Web Site document
...
@@ -194,7 +186,7 @@ class TestERP5Web(ERP5TypeTestCase):
...
@@ -194,7 +186,7 @@ class TestERP5Web(ERP5TypeTestCase):
if it is wrapped by certian column width.
if it is wrapped by certian column width.
"""
"""
# disable portal_transforms cache
# disable portal_transforms cache
self
.
portal
.
portal_transforms
.
max_sec_in_cache
=
-
1
self
.
portal
.
portal_transforms
.
max_sec_in_cache
=
-
1
page
=
self
.
web_page_module
.
newContent
(
portal_type
=
'Web Page'
)
page
=
self
.
web_page_module
.
newContent
(
portal_type
=
'Web Page'
)
page
.
edit
(
text_content
=
'<p>Hé Hé Hé!</p>'
)
page
.
edit
(
text_content
=
'<p>Hé Hé Hé!</p>'
)
self
.
stepTic
()
self
.
stepTic
()
...
@@ -211,21 +203,22 @@ Hé Hé Hé!""", page.asText().strip())
...
@@ -211,21 +203,22 @@ Hé Hé Hé!""", page.asText().strip())
self
.
setupWebSite
()
self
.
setupWebSite
()
portal
=
self
.
getPortal
()
portal
=
self
.
getPortal
()
request
=
self
.
app
.
REQUEST
request
=
self
.
app
.
REQUEST
kw
=
dict
(
reference
=
'web'
,
kw
=
dict
(
reference
=
'web'
,
first_name
=
'TestFN'
,
first_name
=
'TestFN'
,
last_name
=
'TestLN'
,
last_name
=
'TestLN'
,
default_email_text
=
'test@test.com'
,
default_email_text
=
'test@test.com'
,
password
=
'abc'
,
password
=
'abc'
,
password_confirm
=
'abc'
,)
password_confirm
=
'abc'
,)
for
key
,
item
in
kw
.
items
():
for
key
,
item
in
kw
.
items
():
request
.
set
(
'field_your_%s'
%
key
,
item
)
request
.
set
(
'field_your_%s'
%
key
,
item
)
website
=
portal
.
web_site_module
[
self
.
website_id
]
website
=
self
.
web_site_module
[
self
.
website_id
]
website
.
WebSite_createWebSiteAccount
(
'WebSite_viewRegistrationDialog'
)
website
.
WebSite_createWebSiteAccount
(
'WebSite_viewRegistrationDialog'
)
self
.
stepTic
()
self
.
stepTic
()
# find person object by reference
# find person object by reference
person
=
website
.
ERP5Site_getAuthenticatedMemberPersonValue
(
kw
[
'reference'
])
person
=
website
.
ERP5Site_getAuthenticatedMemberPersonValue
(
kw
[
'reference'
])
self
.
assertEquals
(
person
.
getReference
(),
kw
[
'reference'
])
self
.
assertEquals
(
person
.
getReference
(),
kw
[
'reference'
])
self
.
assertEquals
(
person
.
getFirstName
(),
kw
[
'first_name'
])
self
.
assertEquals
(
person
.
getFirstName
(),
kw
[
'first_name'
])
self
.
assertEquals
(
person
.
getLastName
(),
kw
[
'last_name'
])
self
.
assertEquals
(
person
.
getLastName
(),
kw
[
'last_name'
])
...
@@ -234,24 +227,26 @@ Hé Hé Hé!""", page.asText().strip())
...
@@ -234,24 +227,26 @@ Hé Hé Hé!""", page.asText().strip())
# check if user account is 'loggable'
# check if user account is 'loggable'
uf
=
portal
.
acl_users
uf
=
portal
.
acl_users
user
=
uf
.
getUserById
(
kw
[
'reference'
])
user
=
uf
.
getUserById
(
kw
[
'reference'
])
self
.
assertEquals
(
str
(
user
),
kw
[
'reference'
])
self
.
assertEquals
(
str
(
user
),
kw
[
'reference'
])
self
.
assertEquals
(
1
,
user
.
has_role
((
'Member'
,
'Authenticated'
,)))
self
.
assertEquals
(
1
,
user
.
has_role
((
'Member'
,
'Authenticated'
,)))
self
.
login
(
kw
[
'reference'
])
self
.
login
(
kw
[
'reference'
])
self
.
assertEquals
(
kw
[
'reference'
],
str
(
self
.
portal
.
portal_membership
.
getAuthenticatedMember
()))
self
.
assertEquals
(
kw
[
'reference'
],
str
(
portal
.
portal_membership
.
getAuthenticatedMember
()))
# test redirection to person oobject
# test redirection to person oobject
path
=
website
.
absolute_url_path
()
+
'/WebSite_redirectToUserView'
path
=
website
.
absolute_url_path
()
+
'/WebSite_redirectToUserView'
response
=
self
.
publish
(
path
,
'%s:%s'
%
(
kw
[
'reference'
],
kw
[
'password'
]))
response
=
self
.
publish
(
path
,
'%s:%s'
%
(
kw
[
'reference'
],
kw
[
'password'
]))
self
.
assertTrue
(
person
.
getRelativeUrl
()
in
response
.
getHeader
(
"Location"
))
self
.
assertTrue
(
person
.
getRelativeUrl
()
in
response
.
getHeader
(
"Location"
))
# test redirecting to new Person preference
# test redirecting to new Person preference
path
=
website
.
absolute_url_path
()
+
'/WebSite_redirectToUserPreference'
path
=
website
.
absolute_url_path
()
+
'/WebSite_redirectToUserPreference'
response
=
self
.
publish
(
path
,
'%s:%s'
%
(
kw
[
'reference'
],
kw
[
'password'
]))
response
=
self
.
publish
(
path
,
'%s:%s'
%
(
kw
[
'reference'
],
kw
[
'password'
]))
self
.
assertTrue
(
'portal_preferences'
in
response
.
getHeader
(
"Location"
))
self
.
assertTrue
(
'portal_preferences'
in
response
.
getHeader
(
"Location"
))
# one preference should be created for user
# one preference should be created for user
self
.
assertEquals
(
1
,
self
.
portal
.
portal_catalog
.
countResults
(
**
{
'portal_type'
:
'Preference'
,
self
.
assertEquals
(
1
,
'owner'
:
kw
[
'reference'
]})[
0
][
0
])
self
.
portal
.
portal_catalog
.
countResults
(
**
{
'portal_type'
:
'Preference'
,
'owner'
:
kw
[
'reference'
]})[
0
][
0
])
def
test_04_WebPageTranslation
(
self
):
def
test_04_WebPageTranslation
(
self
):
"""
"""
...
@@ -259,18 +254,17 @@ Hé Hé Hé!""", page.asText().strip())
...
@@ -259,18 +254,17 @@ Hé Hé Hé!""", page.asText().strip())
current user selected language in browser.
current user selected language in browser.
"""
"""
portal
=
self
.
getPortal
()
portal
=
self
.
getPortal
()
request
=
self
.
app
.
REQUEST
website
=
self
.
setupWebSite
()
website
=
self
.
setupWebSite
()
websection
=
self
.
setupWebSection
()
websection
=
self
.
setupWebSection
()
page_reference
=
'default-webpage'
page_reference
=
'default-webpage'
webpage_list
=
self
.
setupWebSitePages
(
prefix
=
page_reference
)
webpage_list
=
self
.
setupWebSitePages
(
prefix
=
page_reference
)
# set default web page for section
# set default web page for section
found_by_reference
=
portal
.
portal_catalog
(
name
=
page_reference
,
found_by_reference
=
portal
.
portal_catalog
(
name
=
page_reference
,
portal_type
=
'Web Page'
)
portal_type
=
'Web Page'
)
found
=
found_by_reference
[
0
].
getObject
()
found
=
found_by_reference
[
0
].
getObject
()
websection
.
edit
(
categories_list
=
[
'aggregate/%s'
%
found
.
getRelativeUrl
(),
])
websection
.
edit
(
categories_list
=
[
'aggregate/%s'
%
found
.
getRelativeUrl
()
])
self
.
assertEqual
([
found
.
getReference
()
,
],
self
.
assertEqual
([
found
.
getReference
()],
websection
.
getAggregateReferenceList
())
websection
.
getAggregateReferenceList
())
# even though we create many pages we should get only one
# even though we create many pages we should get only one
# this is the most recent one since all share the same reference
# this is the most recent one since all share the same reference
...
@@ -283,14 +277,14 @@ Hé Hé Hé!""", page.asText().strip())
...
@@ -283,14 +277,14 @@ Hé Hé Hé!""", page.asText().strip())
# set default language in Localizer only to check that we get
# set default language in Localizer only to check that we get
# the corresponding web page for language.
# the corresponding web page for language.
# XXX: Extend API so we can select language from REQUEST
# XXX: Extend API so we can select language from REQUEST
portal
.
Localizer
.
manage_changeDefaultLang
(
language
=
language
)
portal
.
Localizer
.
manage_changeDefaultLang
(
language
=
language
)
default_document
=
websection
.
getDefaultDocumentValue
()
default_document
=
websection
.
getDefaultDocumentValue
()
self
.
assertEquals
(
language
,
default_document
.
getLanguage
())
self
.
assertEquals
(
language
,
default_document
.
getLanguage
())
def
test_05_WebPageTextContentSubstitutions
(
self
):
def
test_05_WebPageTextContentSubstitutions
(
self
):
"""
"""
Simple Case of showing the proper text content with and without a
substitution
Simple Case of showing the proper text content with and without a
mapping method.
substitution
mapping method.
In case of asText, the content should be replaced too
In case of asText, the content should be replaced too
"""
"""
content
=
'<a href="${toto}">$titi</a>'
content
=
'<a href="${toto}">$titi</a>'
...
@@ -318,7 +312,8 @@ Hé Hé Hé!""", page.asText().strip())
...
@@ -318,7 +312,8 @@ Hé Hé Hé!""", page.asText().strip())
klass
.
_getTestSubstitutionMapping
=
klass
.
getTestSubstitutionMapping
klass
.
_getTestSubstitutionMapping
=
klass
.
getTestSubstitutionMapping
document
.
setTextContentSubstitutionMappingMethodId
(
'_getTestSubstitutionMapping'
)
document
.
setTextContentSubstitutionMappingMethodId
(
'_getTestSubstitutionMapping'
)
# Even with the same callable object, a restricted method id should not be callable.
# Even with the same callable object, a restricted method
# id should not be callable.
self
.
assertRaises
(
Unauthorized
,
document
.
asStrippedHTML
)
self
.
assertRaises
(
Unauthorized
,
document
.
asStrippedHTML
)
def
test_06_DefaultDocumentForWebSection
(
self
):
def
test_06_DefaultDocumentForWebSection
(
self
):
...
@@ -333,17 +328,17 @@ Hé Hé Hé!""", page.asText().strip())
...
@@ -333,17 +328,17 @@ Hé Hé Hé!""", page.asText().strip())
Note: due to generic ERP5 Web implementation this test highly depends
Note: due to generic ERP5 Web implementation this test highly depends
on WebSection_geDefaulttDocumentValueList
on WebSection_geDefaulttDocumentValueList
"""
"""
portal
=
self
.
getPortal
()
website
=
self
.
setupWebSite
()
website
=
self
.
setupWebSite
()
websection
=
self
.
setupWebSection
()
websection
=
self
.
setupWebSection
()
publication_section_category_id_list
=
[
'documentation'
,
'administration'
]
publication_section_category_id_list
=
[
'documentation'
,
'administration'
]
# create pages belonging to this publication_section 'documentation'
# create pages belonging to this publication_section 'documentation'
web_page_en
=
portal
.
web_page_module
.
newContent
(
portal_type
=
'Web Page'
,
web_page_en
=
self
.
web_page_module
.
newContent
(
id
=
'section_home'
,
portal_type
=
'Web Page'
,
language
=
'en'
,
id
=
'section_home'
,
reference
=
'NXD-DDP'
,
language
=
'en'
,
publication_section_list
=
publication_section_category_id_list
[:
1
])
reference
=
'NXD-DDP'
,
publication_section_list
=
publication_section_category_id_list
[:
1
])
websection
.
setAggregateValue
(
web_page_en
)
websection
.
setAggregateValue
(
web_page_en
)
self
.
stepTic
()
self
.
stepTic
()
self
.
assertEqual
(
None
,
websection
.
getDefaultDocumentValue
())
self
.
assertEqual
(
None
,
websection
.
getDefaultDocumentValue
())
...
@@ -357,7 +352,8 @@ Hé Hé Hé!""", page.asText().strip())
...
@@ -357,7 +352,8 @@ Hé Hé Hé!""", page.asText().strip())
from
Products.ERP5.Document.Document
import
Document
from
Products.ERP5.Document.Document
import
Document
base_list
=
re
.
findall
(
Document
.
base_parser
,
str
(
html_page
))
base_list
=
re
.
findall
(
Document
.
base_parser
,
str
(
html_page
))
base_url
=
base_list
[
0
]
base_url
=
base_list
[
0
]
self
.
assertEqual
(
base_url
,
"%s/%s/"
%
(
websection
.
absolute_url
(),
web_page_en
.
getReference
()))
self
.
assertEqual
(
base_url
,
"%s/%s/"
%
(
websection
.
absolute_url
(),
web_page_en
.
getReference
()))
def
test_06b_DefaultDocumentForWebSite
(
self
):
def
test_06b_DefaultDocumentForWebSite
(
self
):
"""
"""
...
@@ -371,12 +367,11 @@ Hé Hé Hé!""", page.asText().strip())
...
@@ -371,12 +367,11 @@ Hé Hé Hé!""", page.asText().strip())
Note: due to generic ERP5 Web implementation this test highly depends
Note: due to generic ERP5 Web implementation this test highly depends
on WebSection_geDefaulttDocumentValueList
on WebSection_geDefaulttDocumentValueList
"""
"""
portal
=
self
.
getPortal
()
website
=
self
.
setupWebSite
()
website
=
self
.
setupWebSite
()
publication_section_category_id_list
=
[
'documentation'
,
'administration'
]
publication_section_category_id_list
=
[
'documentation'
,
'administration'
]
# create pages belonging to this publication_section 'documentation'
# create pages belonging to this publication_section 'documentation'
web_page_en
=
portal
.
web_page_module
.
newContent
(
portal_type
=
'Web Page'
,
web_page_en
=
self
.
web_page_module
.
newContent
(
portal_type
=
'Web Page'
,
id
=
'site_home'
,
id
=
'site_home'
,
language
=
'en'
,
language
=
'en'
,
reference
=
'NXD-DDP-Site'
,
reference
=
'NXD-DDP-Site'
,
...
@@ -402,7 +397,7 @@ Hé Hé Hé!""", page.asText().strip())
...
@@ -402,7 +397,7 @@ Hé Hé Hé!""", page.asText().strip())
portal
=
self
.
getPortal
()
portal
=
self
.
getPortal
()
website
=
self
.
setupWebSite
()
website
=
self
.
setupWebSite
()
websection
=
self
.
setupWebSection
()
websection
=
self
.
setupWebSection
()
publication_section_category_id_list
=
[
'documentation'
,
'administration'
]
publication_section_category_id_list
=
[
'documentation'
,
'administration'
]
#set predicate on web section using 'publication_section'
#set predicate on web section using 'publication_section'
websection
.
edit
(
membership_criterion_base_category
=
[
'publication_section'
],
websection
.
edit
(
membership_criterion_base_category
=
[
'publication_section'
],
...
@@ -417,31 +412,31 @@ Hé Hé Hé!""", page.asText().strip())
...
@@ -417,31 +412,31 @@ Hé Hé Hé!""", page.asText().strip())
portal
.
portal_categories
.
publication_section
.
newContent
(
portal_type
=
'Category'
,
portal
.
portal_categories
.
publication_section
.
newContent
(
portal_type
=
'Category'
,
id
=
category_id
)
id
=
category_id
)
property_dict
=
{
'01'
:
dict
(
language
=
'en'
,
version
=
"1"
,
reference
=
"A"
),
property_dict
=
{
'01'
:
dict
(
language
=
'en'
,
version
=
"1"
,
reference
=
"A"
),
'02'
:
dict
(
language
=
'en'
,
version
=
"2"
,
reference
=
"B"
),
'02'
:
dict
(
language
=
'en'
,
version
=
"2"
,
reference
=
"B"
),
'03'
:
dict
(
language
=
'en'
,
version
=
"3"
,
reference
=
"C"
),
'03'
:
dict
(
language
=
'en'
,
version
=
"3"
,
reference
=
"C"
),
'04'
:
dict
(
language
=
'pt'
,
version
=
"1"
,
reference
=
"A"
),
'04'
:
dict
(
language
=
'pt'
,
version
=
"1"
,
reference
=
"A"
),
'05'
:
dict
(
language
=
'pt'
,
version
=
"2"
,
reference
=
"C"
),
'05'
:
dict
(
language
=
'pt'
,
version
=
"2"
,
reference
=
"C"
),
'06'
:
dict
(
language
=
'pt'
,
version
=
"3"
,
reference
=
"B"
),
'06'
:
dict
(
language
=
'pt'
,
version
=
"3"
,
reference
=
"B"
),
'07'
:
dict
(
language
=
'ja'
,
version
=
"1"
,
reference
=
"C"
),
'07'
:
dict
(
language
=
'ja'
,
version
=
"1"
,
reference
=
"C"
),
'08'
:
dict
(
language
=
'ja'
,
version
=
"2"
,
reference
=
"A"
),
'08'
:
dict
(
language
=
'ja'
,
version
=
"2"
,
reference
=
"A"
),
'09'
:
dict
(
language
=
'ja'
,
version
=
"3"
,
reference
=
"B"
),
'09'
:
dict
(
language
=
'ja'
,
version
=
"3"
,
reference
=
"B"
),
'10'
:
dict
(
language
=
'en'
,
version
=
"2"
,
reference
=
"D"
),
'10'
:
dict
(
language
=
'en'
,
version
=
"2"
,
reference
=
"D"
),
'11'
:
dict
(
language
=
'ja'
,
version
=
"3"
,
reference
=
"E"
),
'11'
:
dict
(
language
=
'ja'
,
version
=
"3"
,
reference
=
"E"
),
'12'
:
dict
(
language
=
'pt'
,
version
=
"3"
,
reference
=
"F"
),
'12'
:
dict
(
language
=
'pt'
,
version
=
"3"
,
reference
=
"F"
),
'13'
:
dict
(
language
=
'en'
,
version
=
"3"
,
reference
=
"D"
),
'13'
:
dict
(
language
=
'en'
,
version
=
"3"
,
reference
=
"D"
),
'14'
:
dict
(
language
=
'ja'
,
version
=
"2"
,
reference
=
"E"
),
'14'
:
dict
(
language
=
'ja'
,
version
=
"2"
,
reference
=
"E"
),
'15'
:
dict
(
language
=
'pt'
,
version
=
"2"
,
reference
=
"F"
),
'15'
:
dict
(
language
=
'pt'
,
version
=
"2"
,
reference
=
"F"
),
'16'
:
dict
(
language
=
''
,
version
=
"1"
,
reference
=
"A"
),
'16'
:
dict
(
language
=
''
,
version
=
"1"
,
reference
=
"A"
),
}
}
sequence_one
=
property_dict
.
keys
()
sequence_one
=
property_dict
.
keys
()
sequence_two
=
[
'01'
,
'13'
,
'12'
,
'09'
,
'06'
,
'15'
,
'04'
,
'11'
,
'02'
,
'05'
,
'03
'
,
sequence_two
=
[
'01'
,
'13'
,
'12'
,
'09'
,
'06'
,
'15'
,
'04'
,
'11'
,
'02
'
,
'07'
,
'10'
,
'08'
,
'14'
,
'16'
]
'0
5'
,
'03'
,
'0
7'
,
'10'
,
'08'
,
'14'
,
'16'
]
sequence_three
=
[
'05'
,
'12'
,
'13'
,
'14'
,
'06'
,
'09'
,
'10'
,
'07'
,
'03'
,
'01'
,
'02
'
,
sequence_three
=
[
'05'
,
'12'
,
'13'
,
'14'
,
'06'
,
'09'
,
'10'
,
'07
'
,
'11'
,
'04'
,
'08'
,
'15'
,
'16'
]
'03'
,
'01'
,
'02'
,
'11'
,
'04'
,
'08'
,
'15'
,
'16'
]
sequence_count
=
0
sequence_count
=
0
for
sequence
in
[
sequence_one
,
sequence_two
,
sequence_three
]:
for
sequence
in
[
sequence_one
,
sequence_two
,
sequence_three
]:
sequence_count
+=
1
sequence_count
+=
1
message
=
'
\
n
test_07_WebSection_getDocumentValueList (Sequence %s)'
\
message
=
'
\
n
test_07_WebSection_getDocumentValueList (Sequence %s)'
\
%
(
sequence_count
)
%
(
sequence_count
)
...
@@ -449,7 +444,7 @@ Hé Hé Hé!""", page.asText().strip())
...
@@ -449,7 +444,7 @@ Hé Hé Hé!""", page.asText().strip())
web_page_list
=
[]
web_page_list
=
[]
for
key
in
sequence
:
for
key
in
sequence
:
web_page
=
self
.
portal
.
web_page_module
.
newContent
(
web_page
=
self
.
web_page_module
.
newContent
(
title
=
key
,
title
=
key
,
portal_type
=
'Web Page'
,
portal_type
=
'Web Page'
,
publication_section_list
=
publication_section_category_id_list
[:
1
])
publication_section_list
=
publication_section_category_id_list
[:
1
])
...
@@ -472,105 +467,105 @@ Hé Hé Hé!""", page.asText().strip())
...
@@ -472,105 +467,105 @@ Hé Hé Hé!""", page.asText().strip())
# Testing for language parameter
# Testing for language parameter
self
.
assertEqual
(
4
,
len
(
websection
.
getDocumentValueList
()))
self
.
assertEqual
(
4
,
len
(
websection
.
getDocumentValueList
()))
self
.
assertEqual
([
'en'
,
'en'
,
'en'
,
'en'
],
self
.
assertEqual
([
'en'
,
'en'
,
'en'
,
'en'
],
[
w
.
getLanguage
()
for
w
in
websection
.
getDocumentValueList
()])
[
w
.
getLanguage
()
for
w
in
websection
.
getDocumentValueList
()])
# Check that receiving an empty string as language parameter (as done
# Check that receiving an empty string as language parameter (as done
# when using listbox search) correctly returns user language documents.
# when using listbox search) correctly returns user language documents.
default_document_value_list
=
websection
.
getDocumentValueList
(
language
=
''
)
default_document_value_list
=
websection
.
getDocumentValueList
(
language
=
''
)
self
.
assertEqual
(
4
,
len
(
default_document_value_list
))
self
.
assertEqual
(
4
,
len
(
default_document_value_list
))
self
.
assertEqual
([
'en'
,
'en'
,
'en'
,
'en'
],
self
.
assertEqual
([
'en'
,
'en'
,
'en'
,
'en'
],
[
w
.
getLanguage
()
for
w
in
default_document_value_list
])
[
w
.
getLanguage
()
for
w
in
default_document_value_list
])
pt_document_value_list
=
websection
.
getDocumentValueList
(
language
=
'pt'
)
pt_document_value_list
=
websection
.
getDocumentValueList
(
language
=
'pt'
)
self
.
assertEqual
(
4
,
len
(
pt_document_value_list
))
self
.
assertEqual
(
4
,
len
(
pt_document_value_list
))
self
.
assertEqual
([
'pt'
,
'pt'
,
'pt'
,
'pt'
],
self
.
assertEqual
([
'pt'
,
'pt'
,
'pt'
,
'pt'
],
[
w
.
getObject
().
getLanguage
()
for
w
in
pt_document_value_list
])
[
w
.
getObject
().
getLanguage
()
for
w
in
pt_document_value_list
])
ja_document_value_list
=
websection
.
getDocumentValueList
(
language
=
'ja'
)
ja_document_value_list
=
websection
.
getDocumentValueList
(
language
=
'ja'
)
self
.
assertEqual
(
4
,
len
(
ja_document_value_list
))
self
.
assertEqual
(
4
,
len
(
ja_document_value_list
))
self
.
assertEqual
([
'ja'
,
'ja'
,
'ja'
,
'ja'
],
self
.
assertEqual
([
'ja'
,
'ja'
,
'ja'
,
'ja'
],
[
w
.
getLanguage
()
for
w
in
ja_document_value_list
])
[
w
.
getLanguage
()
for
w
in
ja_document_value_list
])
bg_document_value_list
=
websection
.
getDocumentValueList
(
language
=
'bg'
)
bg_document_value_list
=
websection
.
getDocumentValueList
(
language
=
'bg'
)
self
.
assertEqual
(
1
,
len
(
bg_document_value_list
))
self
.
assertEqual
(
1
,
len
(
bg_document_value_list
))
self
.
assertEqual
([
''
],
self
.
assertEqual
([
''
],
[
w
.
getLanguage
()
for
w
in
bg_document_value_list
])
[
w
.
getLanguage
()
for
w
in
bg_document_value_list
])
# Testing for all_versions parameter
# Testing for all_versions parameter
en_document_value_list
=
websection
.
getDocumentValueList
(
all_versions
=
1
)
en_document_value_list
=
websection
.
getDocumentValueList
(
all_versions
=
1
)
self
.
assertEqual
(
5
,
len
(
en_document_value_list
))
self
.
assertEqual
(
5
,
len
(
en_document_value_list
))
self
.
assertEqual
([
'en'
,
'en'
,
'en'
,
'en'
,
'en'
],
self
.
assertEqual
([
'en'
,
'en'
,
'en'
,
'en'
,
'en'
],
[
w
.
getLanguage
()
for
w
in
en_document_value_list
])
[
w
.
getLanguage
()
for
w
in
en_document_value_list
])
pt_document_value_list
=
websection
.
getDocumentValueList
(
language
=
'pt'
,
pt_document_value_list
=
websection
.
getDocumentValueList
(
language
=
'pt'
,
all_versions
=
1
)
all_versions
=
1
)
self
.
assertEqual
(
5
,
len
(
pt_document_value_list
))
self
.
assertEqual
(
5
,
len
(
pt_document_value_list
))
self
.
assertEqual
([
'pt'
,
'pt'
,
'pt'
,
'pt'
,
'pt'
],
self
.
assertEqual
([
'pt'
,
'pt'
,
'pt'
,
'pt'
,
'pt'
],
[
w
.
getObject
().
getLanguage
()
for
w
in
pt_document_value_list
])
[
w
.
getObject
().
getLanguage
()
for
w
in
pt_document_value_list
])
ja_document_value_list
=
websection
.
getDocumentValueList
(
language
=
'ja'
,
ja_document_value_list
=
websection
.
getDocumentValueList
(
language
=
'ja'
,
all_versions
=
1
)
all_versions
=
1
)
self
.
assertEqual
(
5
,
len
(
ja_document_value_list
))
self
.
assertEqual
(
5
,
len
(
ja_document_value_list
))
self
.
assertEqual
([
'ja'
,
'ja'
,
'ja'
,
'ja'
,
'ja'
],
self
.
assertEqual
([
'ja'
,
'ja'
,
'ja'
,
'ja'
,
'ja'
],
[
w
.
getLanguage
()
for
w
in
ja_document_value_list
])
[
w
.
getLanguage
()
for
w
in
ja_document_value_list
])
# Tests for all_languages parameter
# Tests for all_languages parameter
en_document_value_list
=
websection
.
WebSection_getDocumentValueListBase
(
all_languages
=
1
)
en_document_value_list
=
websection
.
WebSection_getDocumentValueListBase
(
all_languages
=
1
)
self
.
assertEqual
(
6
,
len
(
en_document_value_list
))
self
.
assertEqual
(
6
,
len
(
en_document_value_list
))
self
.
assertEqual
(
4
,
len
([
w
.
getLanguage
()
for
w
in
en_document_value_list
\
self
.
assertEqual
(
4
,
len
([
w
.
getLanguage
()
for
w
in
en_document_value_list
\
if
w
.
getLanguage
()
==
'en'
]))
if
w
.
getLanguage
()
==
'en'
]))
self
.
assertEqual
(
1
,
len
([
w
.
getLanguage
()
for
w
in
en_document_value_list
\
self
.
assertEqual
(
1
,
len
([
w
.
getLanguage
()
for
w
in
en_document_value_list
\
if
w
.
getLanguage
()
==
'pt'
]))
if
w
.
getLanguage
()
==
'pt'
]))
self
.
assertEqual
([
'3'
],
[
w
.
getVersion
()
for
w
in
en_document_value_list
\
self
.
assertEqual
([
'3'
],
[
w
.
getVersion
()
for
w
in
en_document_value_list
\
if
w
.
getLanguage
()
==
'pt'
])
if
w
.
getLanguage
()
==
'pt'
])
self
.
assertEqual
(
1
,
len
([
w
.
getLanguage
()
for
w
in
en_document_value_list
\
self
.
assertEqual
(
1
,
len
([
w
.
getLanguage
()
for
w
in
en_document_value_list
\
if
w
.
getLanguage
()
==
'ja'
]))
if
w
.
getLanguage
()
==
'ja'
]))
self
.
assertEqual
([
'3'
],
[
w
.
getVersion
()
for
w
in
en_document_value_list
\
self
.
assertEqual
([
'3'
],
[
w
.
getVersion
()
for
w
in
en_document_value_list
\
if
w
.
getLanguage
()
==
'ja'
])
if
w
.
getLanguage
()
==
'ja'
])
pt_document_value_list
=
websection
.
WebSection_getDocumentValueListBase
(
all_languages
=
1
,
pt_document_value_list
=
websection
.
WebSection_getDocumentValueListBase
(
all_languages
=
1
,
language
=
'pt'
)
language
=
'pt'
)
self
.
assertEqual
(
6
,
len
(
pt_document_value_list
))
self
.
assertEqual
(
6
,
len
(
pt_document_value_list
))
self
.
assertEqual
(
4
,
len
([
w
.
getLanguage
()
for
w
in
pt_document_value_list
\
self
.
assertEqual
(
4
,
len
([
w
.
getLanguage
()
for
w
in
pt_document_value_list
\
if
w
.
getLanguage
()
==
'pt'
]))
if
w
.
getLanguage
()
==
'pt'
]))
self
.
assertEqual
(
1
,
len
([
w
.
getLanguage
()
for
w
in
pt_document_value_list
\
self
.
assertEqual
(
1
,
len
([
w
.
getLanguage
()
for
w
in
pt_document_value_list
\
if
w
.
getLanguage
()
==
'en'
]))
if
w
.
getLanguage
()
==
'en'
]))
self
.
assertEqual
([
'3'
],
[
w
.
getVersion
()
for
w
in
pt_document_value_list
\
self
.
assertEqual
([
'3'
],
[
w
.
getVersion
()
for
w
in
pt_document_value_list
\
if
w
.
getLanguage
()
==
'en'
])
if
w
.
getLanguage
()
==
'en'
])
self
.
assertEqual
(
1
,
len
([
w
.
getLanguage
()
for
w
in
pt_document_value_list
\
self
.
assertEqual
(
1
,
len
([
w
.
getLanguage
()
for
w
in
pt_document_value_list
\
if
w
.
getLanguage
()
==
'ja'
]))
if
w
.
getLanguage
()
==
'ja'
]))
self
.
assertEqual
([
'3'
],
[
w
.
getVersion
()
for
w
in
pt_document_value_list
\
self
.
assertEqual
([
'3'
],
[
w
.
getVersion
()
for
w
in
pt_document_value_list
\
if
w
.
getLanguage
()
==
'ja'
])
if
w
.
getLanguage
()
==
'ja'
])
ja_document_value_list
=
websection
.
WebSection_getDocumentValueListBase
(
all_languages
=
1
,
ja_document_value_list
=
websection
.
WebSection_getDocumentValueListBase
(
all_languages
=
1
,
language
=
'ja'
)
language
=
'ja'
)
self
.
assertEqual
(
6
,
len
(
ja_document_value_list
))
self
.
assertEqual
(
6
,
len
(
ja_document_value_list
))
self
.
assertEqual
(
4
,
len
([
w
.
getLanguage
()
for
w
in
ja_document_value_list
\
self
.
assertEqual
(
4
,
len
([
w
.
getLanguage
()
for
w
in
ja_document_value_list
\
if
w
.
getLanguage
()
==
'ja'
]))
if
w
.
getLanguage
()
==
'ja'
]))
self
.
assertEqual
(
1
,
len
([
w
.
getLanguage
()
for
w
in
ja_document_value_list
\
self
.
assertEqual
(
1
,
len
([
w
.
getLanguage
()
for
w
in
ja_document_value_list
\
if
w
.
getLanguage
()
==
'pt'
]))
if
w
.
getLanguage
()
==
'pt'
]))
self
.
assertEqual
([
'3'
],
[
w
.
getVersion
()
for
w
in
ja_document_value_list
\
self
.
assertEqual
([
'3'
],
[
w
.
getVersion
()
for
w
in
ja_document_value_list
\
if
w
.
getLanguage
()
==
'pt'
])
if
w
.
getLanguage
()
==
'pt'
])
self
.
assertEqual
(
1
,
len
([
w
.
getLanguage
()
for
w
in
ja_document_value_list
\
self
.
assertEqual
(
1
,
len
([
w
.
getLanguage
()
for
w
in
ja_document_value_list
\
if
w
.
getLanguage
()
==
'en'
]))
if
w
.
getLanguage
()
==
'en'
]))
self
.
assertEqual
([
'3'
],
[
w
.
getVersion
()
for
w
in
ja_document_value_list
\
self
.
assertEqual
([
'3'
],
[
w
.
getVersion
()
for
w
in
ja_document_value_list
\
if
w
.
getLanguage
()
==
'en'
])
if
w
.
getLanguage
()
==
'en'
])
bg_document_value_list
=
websection
.
WebSection_getDocumentValueListBase
(
all_languages
=
1
,
bg_document_value_list
=
websection
.
WebSection_getDocumentValueListBase
(
all_languages
=
1
,
language
=
'bg'
)
language
=
'bg'
)
self
.
assertEqual
(
6
,
len
(
bg_document_value_list
))
self
.
assertEqual
(
6
,
len
(
bg_document_value_list
))
self
.
assertEqual
(
0
,
len
([
w
.
getLanguage
()
for
w
in
bg_document_value_list
\
self
.
assertEqual
(
0
,
len
([
w
.
getLanguage
()
for
w
in
bg_document_value_list
\
if
w
.
getLanguage
()
==
'bg'
]))
if
w
.
getLanguage
()
==
'bg'
]))
self
.
assertEqual
(
3
,
len
([
w
.
getLanguage
()
for
w
in
bg_document_value_list
\
self
.
assertEqual
(
3
,
len
([
w
.
getLanguage
()
for
w
in
bg_document_value_list
\
if
w
.
getLanguage
()
==
'en'
]))
if
w
.
getLanguage
()
==
'en'
]))
self
.
assertEqual
(
1
,
len
([
w
.
getLanguage
()
for
w
in
bg_document_value_list
\
self
.
assertEqual
(
1
,
len
([
w
.
getLanguage
()
for
w
in
bg_document_value_list
\
if
w
.
getLanguage
()
==
'pt'
]))
if
w
.
getLanguage
()
==
'pt'
]))
self
.
assertEqual
([
'3'
],
[
w
.
getVersion
()
for
w
in
bg_document_value_list
\
self
.
assertEqual
([
'3'
],
[
w
.
getVersion
()
for
w
in
bg_document_value_list
\
if
w
.
getLanguage
()
==
'pt'
])
if
w
.
getLanguage
()
==
'pt'
])
self
.
assertEqual
(
1
,
len
([
w
.
getLanguage
()
for
w
in
bg_document_value_list
\
self
.
assertEqual
(
1
,
len
([
w
.
getLanguage
()
for
w
in
bg_document_value_list
\
if
w
.
getLanguage
()
==
'ja'
]))
if
w
.
getLanguage
()
==
'ja'
]))
self
.
assertEqual
([
'3'
],
[
w
.
getVersion
()
for
w
in
bg_document_value_list
\
self
.
assertEqual
([
'3'
],
[
w
.
getVersion
()
for
w
in
bg_document_value_list
\
if
w
.
getLanguage
()
==
'ja'
])
if
w
.
getLanguage
()
==
'ja'
])
# Tests for all_languages and all_versions
# Tests for all_languages and all_versions
...
@@ -585,51 +580,51 @@ Hé Hé Hé!""", page.asText().strip())
...
@@ -585,51 +580,51 @@ Hé Hé Hé!""", page.asText().strip())
all_versions
=
1
,
all_versions
=
1
,
language
=
'ja'
)
language
=
'ja'
)
for
document_value_list
in
[
en_document_value_list
,
pt_document_value_list
,
for
document_value_list
in
[
en_document_value_list
,
pt_document_value_list
,
ja_document_value_list
]:
ja_document_value_list
]:
self
.
assertEqual
(
16
,
len
(
document_value_list
))
self
.
assertEqual
(
16
,
len
(
document_value_list
))
self
.
assertEqual
(
5
,
len
([
w
.
getLanguage
()
for
w
in
document_value_list
\
self
.
assertEqual
(
5
,
len
([
w
.
getLanguage
()
for
w
in
document_value_list
\
if
w
.
getLanguage
()
==
'en'
]))
if
w
.
getLanguage
()
==
'en'
]))
self
.
assertEqual
(
5
,
len
([
w
.
getLanguage
()
for
w
in
en_document_value_list
\
self
.
assertEqual
(
5
,
len
([
w
.
getLanguage
()
for
w
in
en_document_value_list
\
if
w
.
getLanguage
()
==
'pt'
]))
if
w
.
getLanguage
()
==
'pt'
]))
self
.
assertEqual
(
5
,
len
([
w
.
getLanguage
()
for
w
in
en_document_value_list
\
self
.
assertEqual
(
5
,
len
([
w
.
getLanguage
()
for
w
in
en_document_value_list
\
if
w
.
getLanguage
()
==
'ja'
]))
if
w
.
getLanguage
()
==
'ja'
]))
# Tests for sort_on parameter
# Tests for sort_on parameter
self
.
assertEqual
([
'A'
,
'B'
,
'C'
,
'D'
],
self
.
assertEqual
([
'A'
,
'B'
,
'C'
,
'D'
],
[
w
.
getReference
()
for
w
in
\
[
w
.
getReference
()
for
w
in
\
websection
.
getDocumentValueList
(
sort_on
=
[(
'reference'
,
'ASC'
)])])
websection
.
getDocumentValueList
(
sort_on
=
[(
'reference'
,
'ASC'
)])])
self
.
assertEqual
([
'01'
,
'02'
,
'03'
,
'13'
],
self
.
assertEqual
([
'01'
,
'02'
,
'03'
,
'13'
],
[
w
.
getTitle
()
for
w
in
\
[
w
.
getTitle
()
for
w
in
\
websection
.
getDocumentValueList
(
sort_on
=
[(
'title'
,
'ASC'
)])])
websection
.
getDocumentValueList
(
sort_on
=
[(
'title'
,
'ASC'
)])])
self
.
assertEqual
([
'D'
,
'C'
,
'B'
,
'A'
],
self
.
assertEqual
([
'D'
,
'C'
,
'B'
,
'A'
],
[
w
.
getReference
()
for
w
in
\
[
w
.
getReference
()
for
w
in
\
websection
.
getDocumentValueList
(
sort_on
=
[(
'reference'
,
'DESC'
)])])
websection
.
getDocumentValueList
(
sort_on
=
[(
'reference'
,
'DESC'
)])])
self
.
assertEqual
([
'13'
,
'03'
,
'02'
,
'01'
],
self
.
assertEqual
([
'13'
,
'03'
,
'02'
,
'01'
],
[
w
.
getTitle
()
for
w
in
\
[
w
.
getTitle
()
for
w
in
\
websection
.
getDocumentValueList
(
sort_on
=
[(
'reference'
,
'DESC'
)])])
websection
.
getDocumentValueList
(
sort_on
=
[(
'reference'
,
'DESC'
)])])
self
.
assertEqual
([
'A'
,
'B'
,
'C'
,
'D'
,
'E'
,
'F'
],
self
.
assertEqual
([
'A'
,
'B'
,
'C'
,
'D'
,
'E'
,
'F'
],
[
w
.
getReference
()
for
w
in
\
[
w
.
getReference
()
for
w
in
\
websection
.
WebSection_getDocumentValueListBase
(
all_languages
=
1
,
websection
.
WebSection_getDocumentValueListBase
(
all_languages
=
1
,
sort_on
=
[(
'reference'
,
'ASC'
)])])
sort_on
=
[(
'reference'
,
'ASC'
)])])
self
.
assertEqual
([
'01'
,
'02'
,
'03'
,
'11'
,
'12'
,
'13'
],
self
.
assertEqual
([
'01'
,
'02'
,
'03'
,
'11'
,
'12'
,
'13'
],
[
w
.
getTitle
()
for
w
in
\
[
w
.
getTitle
()
for
w
in
\
websection
.
WebSection_getDocumentValueListBase
(
all_languages
=
1
,
websection
.
WebSection_getDocumentValueListBase
(
all_languages
=
1
,
sort_on
=
[(
'title'
,
'ASC'
)])])
sort_on
=
[(
'title'
,
'ASC'
)])])
self
.
assertEqual
([
'F'
,
'E'
,
'D'
,
'C'
,
'B'
,
'A'
],
self
.
assertEqual
([
'F'
,
'E'
,
'D'
,
'C'
,
'B'
,
'A'
],
[
w
.
getReference
()
for
w
in
\
[
w
.
getReference
()
for
w
in
\
websection
.
WebSection_getDocumentValueListBase
(
all_languages
=
1
,
websection
.
WebSection_getDocumentValueListBase
(
all_languages
=
1
,
sort_on
=
[(
'reference'
,
'DESC'
)])])
sort_on
=
[(
'reference'
,
'DESC'
)])])
self
.
assertEqual
([
'13'
,
'12'
,
'11'
,
'03'
,
'02'
,
'01'
],
self
.
assertEqual
([
'13'
,
'12'
,
'11'
,
'03'
,
'02'
,
'01'
],
[
w
.
getTitle
()
for
w
in
\
[
w
.
getTitle
()
for
w
in
\
websection
.
WebSection_getDocumentValueListBase
(
all_languages
=
1
,
websection
.
WebSection_getDocumentValueListBase
(
all_languages
=
1
,
sort_on
=
[(
'title'
,
'DESC'
)])])
sort_on
=
[(
'title'
,
'DESC'
)])])
...
@@ -756,14 +751,12 @@ Hé Hé Hé!""", page.asText().strip())
...
@@ -756,14 +751,12 @@ Hé Hé Hé!""", page.asText().strip())
web_page_portal_type
=
'Web Page'
web_page_portal_type
=
'Web Page'
# Create web site and web section
# Create web site and web section
web_site_module
=
portal
.
getDefaultModule
(
web_site_portal_type
)
web_site
=
self
.
web_site_module
.
newContent
(
portal_type
=
web_site_portal_type
)
web_site
=
web_site_module
.
newContent
(
portal_type
=
web_site_portal_type
)
web_section
=
web_site
.
newContent
(
portal_type
=
web_section_portal_type
)
web_section
=
web_site
.
newContent
(
portal_type
=
web_section_portal_type
)
sub_web_section
=
web_section
.
newContent
(
portal_type
=
web_section_portal_type
)
sub_web_section
=
web_section
.
newContent
(
portal_type
=
web_section_portal_type
)
# Create a document
# Create a document
web_page_module
=
portal
.
getDefaultModule
(
web_page_portal_type
)
web_page
=
self
.
web_page_module
.
newContent
(
portal_type
=
web_page_portal_type
)
web_page
=
web_page_module
.
newContent
(
portal_type
=
web_page_portal_type
)
# Commit transaction
# Commit transaction
def
_commit
():
def
_commit
():
...
@@ -933,7 +926,6 @@ Hé Hé Hé!""", page.asText().strip())
...
@@ -933,7 +926,6 @@ Hé Hé Hé!""", page.asText().strip())
response
=
self
.
publish
(
path
,
self
.
credential
)
response
=
self
.
publish
(
path
,
self
.
credential
)
self
.
assertNotEquals
(
response
.
getBody
().
find
(
new_content
),
-
1
)
self
.
assertNotEquals
(
response
.
getBody
().
find
(
new_content
),
-
1
)
def
test_13a_DocumentMovedCache
(
self
):
def
test_13a_DocumentMovedCache
(
self
):
"""
"""
What happens to the cache if document is moved
What happens to the cache if document is moved
...
@@ -1040,7 +1032,6 @@ Hé Hé Hé!""", page.asText().strip())
...
@@ -1040,7 +1032,6 @@ Hé Hé Hé!""", page.asText().strip())
response
=
self
.
publish
(
path
,
self
.
credential
)
response
=
self
.
publish
(
path
,
self
.
credential
)
self
.
assertNotEquals
(
response
.
getBody
().
find
(
new_content
),
-
1
)
self
.
assertNotEquals
(
response
.
getBody
().
find
(
new_content
),
-
1
)
def
test_14_AccessWebSiteForWithDifferentUserPreferences
(
self
):
def
test_14_AccessWebSiteForWithDifferentUserPreferences
(
self
):
"""Check that Ram Cache Manager do not mix websection
"""Check that Ram Cache Manager do not mix websection
rendering between users.
rendering between users.
...
@@ -1121,7 +1112,6 @@ Hé Hé Hé!""", page.asText().strip())
...
@@ -1121,7 +1112,6 @@ Hé Hé Hé!""", page.asText().strip())
Policy ID - unauthenticated web pages
Policy ID - unauthenticated web pages
authenticated
authenticated
"""
"""
request
=
self
.
portal
.
REQUEST
website
=
self
.
setupWebSite
()
website
=
self
.
setupWebSite
()
web_section_portal_type
=
'Web Section'
web_section_portal_type
=
'Web Section'
web_section
=
website
.
newContent
(
portal_type
=
web_section_portal_type
)
web_section
=
website
.
newContent
(
portal_type
=
web_section_portal_type
)
...
@@ -1185,9 +1175,6 @@ Hé Hé Hé!""", page.asText().strip())
...
@@ -1185,9 +1175,6 @@ Hé Hé Hé!""", page.asText().strip())
- Access it using another language and edit it
- Access it using another language and edit it
- Check that web section is correctly indexed
- Check that web section is correctly indexed
"""
"""
portal
=
self
.
getPortal
()
request
=
self
.
app
.
REQUEST
language
=
'de'
language
=
'de'
website
=
self
.
setupWebSite
()
website
=
self
.
setupWebSite
()
...
@@ -1200,7 +1187,7 @@ Hé Hé Hé!""", page.asText().strip())
...
@@ -1200,7 +1187,7 @@ Hé Hé Hé!""", page.asText().strip())
self
.
stepTic
()
self
.
stepTic
()
response
=
self
.
publish
(
'/%s/%s/%s/%s/Base_editAndEditAsWeb'
%
\
response
=
self
.
publish
(
'/%s/%s/%s/%s/Base_editAndEditAsWeb'
%
\
(
self
.
portal
.
getId
(),
website
.
getRelativeUrl
(),
(
self
.
portal
.
getId
(),
website
.
getRelativeUrl
(),
language
,
websection
.
getId
()),
language
,
websection
.
getId
()),
basic
=
'ERP5TypeTestCase:'
,
basic
=
'ERP5TypeTestCase:'
,
request_method
=
'POST'
,
request_method
=
'POST'
,
...
@@ -1213,7 +1200,7 @@ Hé Hé Hé!""", page.asText().strip())
...
@@ -1213,7 +1200,7 @@ Hé Hé Hé!""", page.asText().strip())
'field_my_title'
:
'%s_edited'
%
websection
.
getId
(),
'field_my_title'
:
'%s_edited'
%
websection
.
getId
(),
}
}
)
)
self
.
assertEquals
(
MOVED_TEMPORARILY
,
response
.
getStatus
())
self
.
assertEquals
(
MOVED_TEMPORARILY
,
response
.
getStatus
())
new_location
=
response
.
getHeader
(
'Location'
)
new_location
=
response
.
getHeader
(
'Location'
)
new_location
=
new_location
.
split
(
'/'
,
3
)[
-
1
]
new_location
=
new_location
.
split
(
'/'
,
3
)[
-
1
]
...
@@ -1222,7 +1209,7 @@ Hé Hé Hé!""", page.asText().strip())
...
@@ -1222,7 +1209,7 @@ Hé Hé Hé!""", page.asText().strip())
response
=
self
.
publish
(
new_location
,
basic
=
'ERP5TypeTestCase:'
,)
response
=
self
.
publish
(
new_location
,
basic
=
'ERP5TypeTestCase:'
,)
self
.
assertEquals
(
HTTP_OK
,
response
.
getStatus
())
self
.
assertEquals
(
HTTP_OK
,
response
.
getStatus
())
self
.
assertEquals
(
'text/html; charset=utf-8'
,
self
.
assertEquals
(
'text/html; charset=utf-8'
,
response
.
getHeader
(
'content-type'
))
response
.
getHeader
(
'content-type'
))
self
.
assertTrue
(
"Data updated."
in
response
.
getBody
())
self
.
assertTrue
(
"Data updated."
in
response
.
getBody
())
...
@@ -1230,7 +1217,7 @@ Hé Hé Hé!""", page.asText().strip())
...
@@ -1230,7 +1217,7 @@ Hé Hé Hé!""", page.asText().strip())
self
.
assertEquals
(
'%s_edited'
%
websection
.
getId
(),
websection
.
getTitle
())
self
.
assertEquals
(
'%s_edited'
%
websection
.
getId
(),
websection
.
getTitle
())
self
.
assertEquals
(
1
,
len
(
self
.
portal
.
portal_catalog
(
self
.
assertEquals
(
1
,
len
(
self
.
portal
.
portal_catalog
(
relative_url
=
websection
.
getRelativeUrl
(),
relative_url
=
websection
.
getRelativeUrl
(),
title
=
websection
.
getTitle
())))
title
=
websection
.
getTitle
())))
@
expectedFailure
@
expectedFailure
...
@@ -1244,9 +1231,6 @@ Hé Hé Hé!""", page.asText().strip())
...
@@ -1244,9 +1231,6 @@ Hé Hé Hé!""", page.asText().strip())
- Access it using another language and edit it
- Access it using another language and edit it
- Check that web site is correctly modified
- Check that web site is correctly modified
"""
"""
portal
=
self
.
getPortal
()
request
=
self
.
app
.
REQUEST
language
=
'de'
language
=
'de'
website
=
self
.
setupWebSite
()
website
=
self
.
setupWebSite
()
...
@@ -1259,7 +1243,7 @@ Hé Hé Hé!""", page.asText().strip())
...
@@ -1259,7 +1243,7 @@ Hé Hé Hé!""", page.asText().strip())
self
.
stepTic
()
self
.
stepTic
()
response
=
self
.
publish
(
'/%s/%s/%s/Base_editAndEditAsWeb'
%
\
response
=
self
.
publish
(
'/%s/%s/%s/Base_editAndEditAsWeb'
%
\
(
self
.
portal
.
getId
(),
website
.
getRelativeUrl
(),
(
self
.
portal
.
getId
(),
website
.
getRelativeUrl
(),
language
),
language
),
basic
=
'ERP5TypeTestCase:'
,
basic
=
'ERP5TypeTestCase:'
,
request_method
=
'POST'
,
request_method
=
'POST'
,
...
@@ -1272,7 +1256,7 @@ Hé Hé Hé!""", page.asText().strip())
...
@@ -1272,7 +1256,7 @@ Hé Hé Hé!""", page.asText().strip())
'field_my_id'
:
language
,
'field_my_id'
:
language
,
}
}
)
)
self
.
assertEquals
(
MOVED_TEMPORARILY
,
response
.
getStatus
())
self
.
assertEquals
(
MOVED_TEMPORARILY
,
response
.
getStatus
())
new_location
=
response
.
getHeader
(
'Location'
)
new_location
=
response
.
getHeader
(
'Location'
)
new_location
=
new_location
.
split
(
'/'
,
3
)[
-
1
]
new_location
=
new_location
.
split
(
'/'
,
3
)[
-
1
]
...
@@ -1281,7 +1265,7 @@ Hé Hé Hé!""", page.asText().strip())
...
@@ -1281,7 +1265,7 @@ Hé Hé Hé!""", page.asText().strip())
response
=
self
.
publish
(
new_location
,
basic
=
'ERP5TypeTestCase:'
,)
response
=
self
.
publish
(
new_location
,
basic
=
'ERP5TypeTestCase:'
,)
self
.
assertEquals
(
HTTP_OK
,
response
.
getStatus
())
self
.
assertEquals
(
HTTP_OK
,
response
.
getStatus
())
self
.
assertEquals
(
'text/html; charset=utf-8'
,
self
.
assertEquals
(
'text/html; charset=utf-8'
,
response
.
getHeader
(
'content-type'
))
response
.
getHeader
(
'content-type'
))
self
.
assertTrue
(
"Data updated."
in
response
.
getBody
())
self
.
assertTrue
(
"Data updated."
in
response
.
getBody
())
...
@@ -1289,27 +1273,26 @@ Hé Hé Hé!""", page.asText().strip())
...
@@ -1289,27 +1273,26 @@ Hé Hé Hé!""", page.asText().strip())
self
.
assertEquals
(
'%s_edited'
%
website
.
getId
(),
website
.
getTitle
())
self
.
assertEquals
(
'%s_edited'
%
website
.
getId
(),
website
.
getTitle
())
self
.
assertEquals
(
1
,
len
(
self
.
portal
.
portal_catalog
(
self
.
assertEquals
(
1
,
len
(
self
.
portal
.
portal_catalog
(
relative_url
=
website
.
getRelativeUrl
(),
relative_url
=
website
.
getRelativeUrl
(),
title
=
website
.
getTitle
())))
title
=
website
.
getTitle
())))
def
test_19_WebModeAndEditableMode
(
self
):
def
test_19_WebModeAndEditableMode
(
self
):
"""
"""
Check if isWebMode & isEditableMode API works.
Check if isWebMode & isEditableMode API works.
"""
"""
portal
=
self
.
getPortal
()
request
=
self
.
app
.
REQUEST
request
=
self
.
app
.
REQUEST
website
=
self
.
setupWebSite
()
website
=
self
.
setupWebSite
()
# web mode
# web mode
self
.
assertEquals
(
False
,
self
.
portal
.
person_module
.
isWebMode
())
self
.
assertEquals
(
False
,
self
.
portal
.
person_module
.
isWebMode
())
self
.
assertEquals
(
True
,
website
.
isWebMode
())
self
.
assertEquals
(
True
,
website
.
isWebMode
())
self
.
assertEquals
(
True
,
getattr
(
website
,
'person_module'
).
isWebMode
())
self
.
assertEquals
(
True
,
getattr
(
website
,
'person_module'
).
isWebMode
())
# editable mode
# editable mode
self
.
assertEquals
(
False
,
self
.
portal
.
person_module
.
isEditableMode
())
self
.
assertEquals
(
False
,
self
.
portal
.
person_module
.
isEditableMode
())
self
.
assertEquals
(
False
,
website
.
isEditableMode
())
self
.
assertEquals
(
False
,
website
.
isEditableMode
())
self
.
assertEquals
(
False
,
getattr
(
website
,
'person_module'
).
isEditableMode
())
self
.
assertEquals
(
False
,
getattr
(
website
,
'person_module'
).
isEditableMode
())
request
.
set
(
'editable_mode'
,
1
)
request
.
set
(
'editable_mode'
,
1
)
self
.
assertEquals
(
1
,
self
.
portal
.
person_module
.
isEditableMode
())
self
.
assertEquals
(
1
,
self
.
portal
.
person_module
.
isEditableMode
())
self
.
assertEquals
(
1
,
website
.
isEditableMode
())
self
.
assertEquals
(
1
,
website
.
isEditableMode
())
...
@@ -1326,45 +1309,43 @@ Hé Hé Hé!""", page.asText().strip())
...
@@ -1326,45 +1309,43 @@ Hé Hé Hé!""", page.asText().strip())
"""
"""
Test Web Site map script.
Test Web Site map script.
"""
"""
portal
=
self
.
getPortal
()
request
=
self
.
app
.
REQUEST
request
=
self
.
app
.
REQUEST
website
=
self
.
setupWebSite
()
website
=
self
.
setupWebSite
()
kw
=
{
'depth'
:
5
,
kw
=
{
'depth'
:
5
,
'include_subsection'
:
1
}
'include_subsection'
:
1
}
website
.
setSiteMapSectionParent
(
1
)
website
.
setSiteMapSectionParent
(
1
)
websection1
=
website
.
newContent
(
portal_type
=
'Web Section'
,
websection1
=
website
.
newContent
(
portal_type
=
'Web Section'
,
title
=
'Section 1'
,
title
=
'Section 1'
,
site_map_section_parent
=
1
,
site_map_section_parent
=
1
,
visible
=
1
)
visible
=
1
)
websection1_1
=
websection1
.
newContent
(
portal_type
=
'Web Section'
,
websection1_1
=
websection1
.
newContent
(
portal_type
=
'Web Section'
,
title
=
'Section 1.1'
,
title
=
'Section 1.1'
,
site_map_section_parent
=
1
,
site_map_section_parent
=
1
,
visible
=
1
)
visible
=
1
)
self
.
stepTic
()
self
.
stepTic
()
site_map
=
website
.
WebSection_getSiteMapTree
(
depth
=
5
,
include_subsection
=
1
)
site_map
=
website
.
WebSection_getSiteMapTree
(
depth
=
5
,
include_subsection
=
1
)
self
.
assertSameSet
([
websection1
.
getTitle
()],
self
.
assertSameSet
([
websection1
.
getTitle
()],
[
x
[
'translated_title'
]
for
x
in
site_map
])
[
x
[
'translated_title'
]
for
x
in
site_map
])
self
.
assertSameSet
([
websection1_1
.
getTitle
()],
self
.
assertSameSet
([
websection1_1
.
getTitle
()],
[
x
[
'translated_title'
]
for
x
in
site_map
[
0
][
'subsection'
]])
[
x
[
'translated_title'
]
for
x
in
site_map
[
0
][
'subsection'
]])
self
.
assertEqual
(
1
,
site_map
[
0
][
'level'
])
self
.
assertEqual
(
1
,
site_map
[
0
][
'level'
])
self
.
assertEqual
(
2
,
site_map
[
0
][
'subsection'
][
0
][
'level'
])
self
.
assertEqual
(
2
,
site_map
[
0
][
'subsection'
][
0
][
'level'
])
# check depth works
# check depth works
site_map
=
website
.
WebSection_getSiteMapTree
(
depth
=
1
,
include_subsection
=
1
)
site_map
=
website
.
WebSection_getSiteMapTree
(
depth
=
1
,
include_subsection
=
1
)
self
.
assertEqual
(
None
,
site_map
[
0
][
'subsection'
])
self
.
assertEqual
(
None
,
site_map
[
0
][
'subsection'
])
self
.
assertSameSet
([
websection1
.
getTitle
()],
self
.
assertSameSet
([
websection1
.
getTitle
()],
[
x
[
'translated_title'
]
for
x
in
site_map
])
[
x
[
'translated_title'
]
for
x
in
site_map
])
# hide subsections
# hide subsections
websection1_1
.
setSiteMapSectionParent
(
0
)
websection1_1
.
setSiteMapSectionParent
(
0
)
websection1_1
.
setVisible
(
0
)
websection1_1
.
setVisible
(
0
)
self
.
stepTic
()
self
.
stepTic
()
site_map
=
website
.
WebSection_getSiteMapTree
(
depth
=
5
,
include_subsection
=
1
)
site_map
=
website
.
WebSection_getSiteMapTree
(
depth
=
5
,
include_subsection
=
1
)
self
.
assertSameSet
([
websection1
.
getTitle
()],
self
.
assertSameSet
([
websection1
.
getTitle
()],
[
x
[
'translated_title'
]
for
x
in
site_map
])
[
x
[
'translated_title'
]
for
x
in
site_map
])
self
.
assertEqual
(
None
,
site_map
[
0
][
'subsection'
])
self
.
assertEqual
(
None
,
site_map
[
0
][
'subsection'
])
class
TestERP5WebWithSimpleSecurity
(
ERP5TypeTestCase
):
class
TestERP5WebWithSimpleSecurity
(
ERP5TypeTestCase
):
...
@@ -1502,8 +1483,7 @@ class TestERP5WebWithSimpleSecurity(ERP5TypeTestCase):
...
@@ -1502,8 +1483,7 @@ class TestERP5WebWithSimpleSecurity(ERP5TypeTestCase):
def
test_03_WebSection_getDocumentValueListSecurity
(
self
):
def
test_03_WebSection_getDocumentValueListSecurity
(
self
):
""" Test WebSection_getDocumentValueList behaviour and security"""
""" Test WebSection_getDocumentValueList behaviour and security"""
self
.
login
(
'admin'
)
self
.
login
(
'admin'
)
web_site_module
=
self
.
portal
.
web_site_module
site
=
self
.
web_site_module
.
newContent
(
portal_type
=
'Web Site'
,
site
=
web_site_module
.
newContent
(
portal_type
=
'Web Site'
,
id
=
'site'
)
id
=
'site'
)
site
.
publish
()
site
.
publish
()
...
@@ -1639,8 +1619,7 @@ class TestERP5WebWithSimpleSecurity(ERP5TypeTestCase):
...
@@ -1639,8 +1619,7 @@ class TestERP5WebWithSimpleSecurity(ERP5TypeTestCase):
def
test_04_ExpireUserAction
(
self
):
def
test_04_ExpireUserAction
(
self
):
""" Test the expire user action"""
""" Test the expire user action"""
self
.
login
(
'admin'
)
self
.
login
(
'admin'
)
web_site_module
=
self
.
portal
.
web_site_module
site
=
self
.
web_site_module
.
newContent
(
portal_type
=
'Web Site'
,
id
=
'site'
)
site
=
web_site_module
.
newContent
(
portal_type
=
'Web Site'
,
id
=
'site'
)
# create websections in a site and in anothers web sections
# create websections in a site and in anothers web sections
section_1
=
site
.
newContent
(
portal_type
=
'Web Section'
,
id
=
'section_1'
)
section_1
=
site
.
newContent
(
portal_type
=
'Web Section'
,
id
=
'section_1'
)
...
@@ -1670,7 +1649,7 @@ class TestERP5WebWithSimpleSecurity(ERP5TypeTestCase):
...
@@ -1670,7 +1649,7 @@ class TestERP5WebWithSimpleSecurity(ERP5TypeTestCase):
def
test_05_createWebSite
(
self
):
def
test_05_createWebSite
(
self
):
""" Test to create or clone web sites with many users """
""" Test to create or clone web sites with many users """
self
.
login
(
'admin'
)
self
.
login
(
'admin'
)
web_site_module
=
self
.
portal
.
web_site_module
web_site_module
=
self
.
web_site_module
# test for admin
# test for admin
try
:
try
:
...
@@ -1693,8 +1672,7 @@ class TestERP5WebWithSimpleSecurity(ERP5TypeTestCase):
...
@@ -1693,8 +1672,7 @@ class TestERP5WebWithSimpleSecurity(ERP5TypeTestCase):
def
test_06_createWebSection
(
self
):
def
test_06_createWebSection
(
self
):
""" Test to create or clone web sections with many users """
""" Test to create or clone web sections with many users """
self
.
login
(
'admin'
)
self
.
login
(
'admin'
)
web_site_module
=
self
.
portal
.
web_site_module
site
=
self
.
web_site_module
.
newContent
(
portal_type
=
'Web Site'
,
id
=
'site'
)
site
=
web_site_module
.
newContent
(
portal_type
=
'Web Site'
,
id
=
'site'
)
# test for admin
# test for admin
try
:
try
:
...
@@ -1806,7 +1784,7 @@ class TestERP5WebWithSimpleSecurity(ERP5TypeTestCase):
...
@@ -1806,7 +1784,7 @@ class TestERP5WebWithSimpleSecurity(ERP5TypeTestCase):
pass
pass
try
:
try
:
new_category_3
=
publication_section
.
newContent
(
new_category_3
=
publication_section
.
newContent
(
portal_type
=
'Category'
,
id
=
'new_category_3'
)
portal_type
=
'Category'
,
id
=
'new_category_3'
)
new_category_4
=
new_category_3
.
newContent
(
portal_type
=
'Category'
,
new_category_4
=
new_category_3
.
newContent
(
portal_type
=
'Category'
,
id
=
'new_category_4'
)
id
=
'new_category_4'
)
except
Unauthorized
:
except
Unauthorized
:
...
@@ -1839,7 +1817,7 @@ class TestERP5WebWithSimpleSecurity(ERP5TypeTestCase):
...
@@ -1839,7 +1817,7 @@ class TestERP5WebWithSimpleSecurity(ERP5TypeTestCase):
project
.
validate
()
project
.
validate
()
self
.
stepTic
()
self
.
stepTic
()
website
=
self
.
portal
.
web_site_module
.
newContent
(
portal_type
=
'Web Site'
,
website
=
self
.
web_site_module
.
newContent
(
portal_type
=
'Web Site'
,
id
=
'site'
)
id
=
'site'
)
website
.
publish
()
website
.
publish
()
website
.
setMembershipCriterionBaseCategory
(
'follow_up'
)
website
.
setMembershipCriterionBaseCategory
(
'follow_up'
)
...
@@ -1876,9 +1854,8 @@ class TestERP5WebWithSimpleSecurity(ERP5TypeTestCase):
...
@@ -1876,9 +1854,8 @@ class TestERP5WebWithSimpleSecurity(ERP5TypeTestCase):
"""
"""
Test that by default Anonymous User cannot access Web Site Module
Test that by default Anonymous User cannot access Web Site Module
"""
"""
portal
=
self
.
portal
self
.
logout
()
self
.
logout
()
self
.
assertRaises
(
Unauthorized
,
portal
.
web_site_module
.
view
)
self
.
assertRaises
(
Unauthorized
,
self
.
web_site_module
.
view
)
class
TestERP5WebCategoryPublicationWorkflow
(
ERP5TypeTestCase
):
class
TestERP5WebCategoryPublicationWorkflow
(
ERP5TypeTestCase
):
...
@@ -1911,6 +1888,7 @@ class TestERP5WebCategoryPublicationWorkflow(ERP5TypeTestCase):
...
@@ -1911,6 +1888,7 @@ class TestERP5WebCategoryPublicationWorkflow(ERP5TypeTestCase):
self
.
doActionFor
(
self
.
category
,
'expire_action'
)
self
.
doActionFor
(
self
.
category
,
'expire_action'
)
self
.
assertEqual
(
'expired_published'
,
self
.
category
.
getValidationState
())
self
.
assertEqual
(
'expired_published'
,
self
.
category
.
getValidationState
())
def
test_suite
():
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
unittest
.
makeSuite
(
TestERP5Web
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestERP5Web
))
...
...
setup.py
View file @
55cd18ec
...
@@ -63,9 +63,12 @@ setup(name=name,
...
@@ -63,9 +63,12 @@ setup(name=name,
entry_points
=
{
entry_points
=
{
'console_scripts'
:
[
'console_scripts'
:
[
'testnode = erp5.util.testnode:main [testnode]'
,
'testnode = erp5.util.testnode:main [testnode]'
,
'performance_tester_erp5 = erp5.util.benchmark.performance_tester:main [benchmark]'
,
'performance_tester_erp5 = '
\
'scalability_tester_erp5 = erp5.util.benchmark.scalability_tester:main [scalability_tester]'
,
'erp5.util.benchmark.performance_tester:main [benchmark]'
,
'generate_erp5_tester_report = erp5.util.benchmark.report:generateReport [benchmark-report]'
,
'scalability_tester_erp5 = '
\
'erp5.util.benchmark.scalability_tester:main [scalability_tester]'
,
'generate_erp5_tester_report = '
\
'erp5.util.benchmark.report:generateReport [benchmark-report]'
,
'web_checker_utility = erp5.util.webchecker:web_checker_utility'
'web_checker_utility = erp5.util.webchecker:web_checker_utility'
],
],
}
}
...
...
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