Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5-Boxiang
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
Hamza
erp5-Boxiang
Commits
c441db2c
Commit
c441db2c
authored
May 23, 2016
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testERP5Web; test website traversal hook for websites and also websections
parent
2f06c766
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
25 deletions
+51
-25
product/ERP5/tests/testERP5Web.py
product/ERP5/tests/testERP5Web.py
+51
-25
No files found.
product/ERP5/tests/testERP5Web.py
View file @
c441db2c
...
@@ -43,6 +43,55 @@ HTTP_OK = 200
...
@@ -43,6 +43,55 @@ HTTP_OK = 200
MOVED_TEMPORARILY
=
302
MOVED_TEMPORARILY
=
302
class
WebTraversalHookTestMixin
(
object
):
"""Mixin class to test the WebSiteTraversalHook on both websection and website.
"""
def
getBusinessTemplateList
(
self
):
return
(
'erp5_base'
,
'erp5_web'
,
)
def
test_TraversalHook_on_newContent
(
self
):
"""a WebSiteTraversalHook is added on websections and websites automatically.
"""
self
.
assertEquals
(
1
,
len
(
self
.
web_section
.
__before_traverse__
))
self
.
assertIsInstance
(
self
.
web_section
.
__before_traverse__
.
values
()[
0
],
self
.
traversal_hook_class
)
def
test_TraversalHook_on_clone
(
self
):
"""a WebSiteTraversalHook is correctly updated after cloning a websection/website.
"""
cloned_web_section
=
self
.
web_section
.
Base_createCloneDocument
(
batch_mode
=
True
)
self
.
assertEquals
(
1
,
len
(
cloned_web_section
.
__before_traverse__
))
def
test_TraversalHook_on_change_id
(
self
):
"""a TraversalHook is correctly updated after changing websection id.
"""
self
.
tic
()
self
.
web_section
.
setId
(
"new_id"
)
self
.
assertEquals
(
1
,
len
(
self
.
web_section
.
__before_traverse__
))
class
TestWebSiteTraversalHook
(
WebTraversalHookTestMixin
,
ERP5TypeTestCase
):
def
afterSetUp
(
self
):
super
(
TestWebSiteTraversalHook
,
self
).
afterSetUp
()
self
.
web_section
=
self
.
portal
.
web_site_module
.
newContent
(
portal_type
=
'Web Site'
,
)
from
Products.ERP5Type.Document.WebSite
import
WebSiteTraversalHook
self
.
traversal_hook_class
=
WebSiteTraversalHook
class
TestWebSectionTraversalHook
(
WebTraversalHookTestMixin
,
ERP5TypeTestCase
):
def
afterSetUp
(
self
):
super
(
TestWebSectionTraversalHook
,
self
).
afterSetUp
()
web_site
=
self
.
portal
.
web_site_module
.
newContent
(
portal_type
=
'Web Site'
,
)
self
.
web_section
=
web_site
.
newContent
(
portal_type
=
'Web Section'
)
from
Products.ERP5Type.Document.WebSection
import
WebSectionTraversalHook
self
.
traversal_hook_class
=
WebSectionTraversalHook
class
TestERP5Web
(
ERP5TypeTestCase
):
class
TestERP5Web
(
ERP5TypeTestCase
):
"""Test for erp5_web business template.
"""Test for erp5_web business template.
"""
"""
...
@@ -169,32 +218,7 @@ class TestERP5Web(ERP5TypeTestCase):
...
@@ -169,32 +218,7 @@ class TestERP5Web(ERP5TypeTestCase):
except
:
except
:
self
.
fail
(
'Cataloging of the Web Site failed.'
)
self
.
fail
(
'Cataloging of the Web Site failed.'
)
def
test_WebSiteTraversalHook_on_newContent
(
self
):
"""a WebSiteTraversalHook is added on websites automatically.
"""
web_site
=
self
.
portal
.
web_site_module
.
newContent
(
portal_type
=
'Web Site'
,
)
self
.
assertEquals
(
1
,
len
(
web_site
.
__before_traverse__
))
def
test_WebSiteTraversalHook_on_clone
(
self
):
"""a WebSiteTraversalHook is correctly updated after cloning a website.
"""
web_site
=
self
.
portal
.
web_site_module
.
newContent
(
portal_type
=
'Web Site'
,
)
cloned_web_site
=
web_site
.
Base_createCloneDocument
(
batch_mode
=
True
)
self
.
assertEquals
(
1
,
len
(
cloned_web_site
.
__before_traverse__
))
def
test_WebSiteTraversalHook_on_change_id
(
self
):
"""a WebSiteTraversalHook is correctly updated after changing website id.
"""
web_site
=
self
.
portal
.
web_site_module
.
newContent
(
portal_type
=
'Web Site'
,
)
self
.
tic
()
web_site
.
setId
(
"new_id"
)
self
.
assertEquals
(
1
,
len
(
web_site
.
__before_traverse__
))
def
test_02_EditSimpleWebPage
(
self
):
def
test_02_EditSimpleWebPage
(
self
):
"""
"""
...
@@ -1959,4 +1983,6 @@ def test_suite():
...
@@ -1959,4 +1983,6 @@ def test_suite():
suite
.
addTest
(
unittest
.
makeSuite
(
TestERP5Web
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestERP5Web
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestERP5WebWithSimpleSecurity
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestERP5WebWithSimpleSecurity
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestERP5WebCategoryPublicationWorkflow
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestERP5WebCategoryPublicationWorkflow
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestWebSiteTraversalHook
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestWebSectionTraversalHook
))
return
suite
return
suite
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