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
Titouan Soulard
erp5
Commits
2eec2f13
Commit
2eec2f13
authored
Feb 06, 2023
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: support Zope2.
parent
42b9b84c
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
99 additions
and
35 deletions
+99
-35
bt5/erp5_big_file/TestTemplateItem/portal_components/test.erp5.testBigFile.py
...stTemplateItem/portal_components/test.erp5.testBigFile.py
+22
-13
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testAutoLogout.py
...emplateItem/portal_components/test.erp5.testAutoLogout.py
+4
-2
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testCookieCrumbler.py
...ateItem/portal_components/test.erp5.testCookieCrumbler.py
+4
-1
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testERP5Type.py
...tTemplateItem/portal_components/test.erp5.testERP5Type.py
+53
-8
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testRestrictedPythonSecurity.py
...rtal_components/test.erp5.testRestrictedPythonSecurity.py
+7
-2
bt5/erp5_corporate_identity_test/TestTemplateItem/portal_components/test.erp5.testCorporateIdentityTemplateList.py
...components/test.erp5.testCorporateIdentityTemplateList.py
+3
-3
bt5/erp5_maileva_connector/TestTemplateItem/portal_components/test.erp5.testMailevaSOAPConnector.py
...m/portal_components/test.erp5.testMailevaSOAPConnector.py
+2
-2
product/CMFActivity/tests/testCMFActivity.py
product/CMFActivity/tests/testCMFActivity.py
+2
-2
product/ERP5Type/tests/ERP5TypeLiveTestCase.py
product/ERP5Type/tests/ERP5TypeLiveTestCase.py
+1
-1
product/ERP5Type/tests/ERP5TypeTestCase.py
product/ERP5Type/tests/ERP5TypeTestCase.py
+1
-1
No files found.
bt5/erp5_big_file/TestTemplateItem/portal_components/test.erp5.testBigFile.py
View file @
2eec2f13
...
...
@@ -29,6 +29,7 @@ from cStringIO import StringIO
from
ZPublisher.HTTPRequest
import
HTTPRequest
from
ZPublisher.HTTPResponse
import
HTTPResponse
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type
import
IS_ZOPE2
from
erp5.component.module.BTreeData
import
BTreeData
...
...
@@ -76,6 +77,14 @@ def request_function(method_name):
get
=
request_function
(
'GET'
)
put
=
request_function
(
'PUT'
)
if
IS_ZOPE2
:
# BBB Zope2
# FIXME Zope translates 308 to 500
# https://github.com/zopefoundation/Zope/blob/2.13/src/ZPublisher/HTTPResponse.py#L223
# https://github.com/zopefoundation/Zope/blob/2.13/src/ZPublisher/HTTPResponse.py#L64
R308
=
500
else
:
R308
=
308
class
TestBigFile
(
ERP5TypeTestCase
):
"""Tests for ERP5.Document.BigFile"""
...
...
@@ -130,7 +139,7 @@ class TestBigFile(ERP5TypeTestCase):
# result body status headers
check
(
get
(),
{
'format'
:
'raw'
},
''
,
''
,
200
,
{
'Content-Length'
:
'0'
})
check
(
put
({
'Content-Range'
:
'bytes */*'
}),{},
''
,
''
,
308
,
{
'Range'
:
'bytes 0--1'
})
# XXX 0--1 ok?
check
(
put
({
'Content-Range'
:
'bytes */*'
}),{},
''
,
''
,
R
308
,
{
'Range'
:
'bytes 0--1'
})
# XXX 0--1 ok?
check
(
get
({
'Range'
:
'bytes=0-0'
}),{},
''
,
''
,
416
,
{
'Content-Length'
:
'0'
,
'Content-Range'
:
'bytes */0'
})
...
...
@@ -140,7 +149,7 @@ class TestBigFile(ERP5TypeTestCase):
self
.
assertEqual
(
f
.
getData
(),
''
)
check
(
get
(),
{
'format'
:
'raw'
},
''
,
''
,
200
,
{
'Content-Length'
:
'0'
})
check
(
put
({
'Content-Range'
:
'bytes */*'
}),{},
''
,
''
,
308
,
{
'Range'
:
'bytes 0--1'
})
# XXX 0--1 ok?
check
(
put
({
'Content-Range'
:
'bytes */*'
}),{},
''
,
''
,
R
308
,
{
'Range'
:
'bytes 0--1'
})
# XXX 0--1 ok?
check
(
get
({
'Range'
:
'bytes=0-0'
}),{},
''
,
''
,
416
,
{
'Content-Range'
:
'bytes */0'
})
...
...
@@ -150,7 +159,7 @@ class TestBigFile(ERP5TypeTestCase):
self
.
assertEqual
(
f
.
getData
(),
'x'
)
check
(
get
(),
{
'format'
:
'raw'
},
''
,
'x'
,
200
,
{
'Content-Length'
:
'1'
})
check
(
put
({
'Content-Range'
:
'bytes */*'
}),{},
''
,
''
,
308
,
{
'Range'
:
'bytes 0-0'
})
check
(
put
({
'Content-Range'
:
'bytes */*'
}),{},
''
,
''
,
R
308
,
{
'Range'
:
'bytes 0-0'
})
check
(
get
({
'Range'
:
'bytes=0-0'
}),{},
''
,
'x'
,
206
,
{
'Content-Length'
:
'1'
,
'Content-Range'
:
'bytes 0-0/1'
})
...
...
@@ -160,7 +169,7 @@ class TestBigFile(ERP5TypeTestCase):
self
.
assertEqual
(
f
.
getData
(),
'xyz'
)
check
(
get
(),
{
'format'
:
'raw'
},
''
,
'xyz'
,
200
,
{
'Content-Length'
:
'3'
})
check
(
put
({
'Content-Range'
:
'bytes */*'
}),{},
''
,
''
,
308
,
{
'Range'
:
'bytes 0-2'
})
check
(
put
({
'Content-Range'
:
'bytes */*'
}),{},
''
,
''
,
R
308
,
{
'Range'
:
'bytes 0-2'
})
check
(
get
({
'Range'
:
'bytes=0-0'
}),{},
''
,
'x'
,
206
,
{
'Content-Length'
:
'1'
,
'Content-Range'
:
'bytes 0-0/3'
})
check
(
get
({
'Range'
:
'bytes=1-1'
}),{},
''
,
'y'
,
206
,
{
'Content-Length'
:
'1'
,
'Content-Range'
:
'bytes 1-1/3'
})
check
(
get
({
'Range'
:
'bytes=2-2'
}),{},
''
,
'z'
,
206
,
{
'Content-Length'
:
'1'
,
'Content-Range'
:
'bytes 2-2/3'
})
...
...
@@ -173,7 +182,7 @@ class TestBigFile(ERP5TypeTestCase):
self
.
assertEqual
(
f
.
getSize
(),
5
)
self
.
assertEqual
(
f
.
getData
(),
'xyz01'
)
check
(
get
(),
{
'format'
:
'raw'
},
''
,
'xyz01'
,
200
,
{
'Content-Length'
:
'5'
})
check
(
put
({
'Content-Range'
:
'bytes */*'
}),{},
''
,
''
,
308
,
{
'Range'
:
'bytes 0-4'
})
check
(
put
({
'Content-Range'
:
'bytes */*'
}),{},
''
,
''
,
R
308
,
{
'Range'
:
'bytes 0-4'
})
check
(
get
({
'Range'
:
'bytes=0-4'
}),{},
''
,
'xyz01'
,
206
,
{
'Content-Length'
:
'5'
,
'Content-Range'
:
'bytes 0-4/5'
})
check
(
get
({
'Range'
:
'bytes=1-3'
}),{},
''
,
'yz0'
,
206
,
{
'Content-Length'
:
'3'
,
'Content-Range'
:
'bytes 1-3/5'
})
check
(
get
({
'Range'
:
'bytes=1-2'
}),{},
''
,
'yz'
,
206
,
{
'Content-Length'
:
'2'
,
'Content-Range'
:
'bytes 1-2/5'
})
...
...
@@ -185,21 +194,21 @@ class TestBigFile(ERP5TypeTestCase):
self
.
assertEqual
(
f
.
getSize
(),
3
)
self
.
assertEqual
(
f
.
getData
(),
'abc'
)
check
(
get
(),
{
'format'
:
'raw'
},
''
,
'abc'
,
200
,
{
'Content-Length'
:
'3'
})
check
(
put
({
'Content-Range'
:
'bytes */*'
}),{},
''
,
''
,
308
,
{
'Range'
:
'bytes 0-2'
})
check
(
put
({
'Content-Range'
:
'bytes */*'
}),{},
''
,
''
,
R
308
,
{
'Range'
:
'bytes 0-2'
})
# append via PUT with range (again)
check
(
put
({
'Content-Range'
:
'bytes 3-7/8'
,
'Content-Length'
:
'5'
},
'defgh'
),{},
''
,
''
,
204
,
{})
self
.
assertEqual
(
f
.
getSize
(),
8
)
self
.
assertEqual
(
f
.
getData
(),
'abcdefgh'
)
check
(
get
(),
{
'format'
:
'raw'
},
''
,
'abcdefgh'
,
200
,
{
'Content-Length'
:
'8'
})
check
(
put
({
'Content-Range'
:
'bytes */*'
}),{},
''
,
''
,
308
,
{
'Range'
:
'bytes 0-7'
})
check
(
put
({
'Content-Range'
:
'bytes */*'
}),{},
''
,
''
,
R
308
,
{
'Range'
:
'bytes 0-7'
})
# append via ._appendData() (again)
f
.
_appendData
(
'ij'
)
self
.
assertEqual
(
f
.
getSize
(),
10
)
self
.
assertEqual
(
f
.
getData
(),
'abcdefghij'
)
check
(
get
(),
{
'format'
:
'raw'
},
''
,
'abcdefghij'
,
200
,
{
'Content-Length'
:
'10'
})
check
(
put
({
'Content-Range'
:
'bytes */*'
}),{},
''
,
''
,
308
,
{
'Range'
:
'bytes 0-9'
})
check
(
put
({
'Content-Range'
:
'bytes */*'
}),{},
''
,
''
,
R
308
,
{
'Range'
:
'bytes 0-9'
})
# make sure PUT with incorrect/non-append range is rejected
check
(
put
({
'Content-Range'
:
'bytes 10-10/10'
,
'Content-Length'
:
'1'
},
'k'
),{},
''
,
''
,
400
,
{
'X-Explanation'
:
'Total size unexpected'
})
...
...
@@ -243,7 +252,7 @@ class TestBigFile(ERP5TypeTestCase):
self
.
assertEqual
(
f
.
getSize
(),
0
)
self
.
assertEqual
(
f
.
getData
(),
''
)
check
(
get
(),
{
'format'
:
'raw'
},
''
,
''
,
200
,
{
'Content-Length'
:
'0'
})
check
(
put
({
'Content-Range'
:
'bytes */*'
}),{},
''
,
''
,
308
,
{
'Range'
:
'bytes 0--1'
})
# XXX 0--1 ok?
check
(
put
({
'Content-Range'
:
'bytes */*'
}),{},
''
,
''
,
R
308
,
{
'Range'
:
'bytes 0--1'
})
# XXX 0--1 ok?
check
(
get
({
'Range'
:
'bytes=0-0'
}),{},
''
,
''
,
416
,
{
'Content-Length'
:
'0'
,
'Content-Range'
:
'bytes */0'
})
...
...
@@ -255,7 +264,7 @@ class TestBigFile(ERP5TypeTestCase):
self
.
assertEqual
(
f
.
getSize
(),
3
)
self
.
assertEqual
(
f
.
getData
(),
'abc'
)
check
(
get
(),
{
'format'
:
'raw'
},
'abc'
,
''
,
200
,
{
'Content-Length'
:
'3'
})
check
(
put
({
'Content-Range'
:
'bytes */*'
}),{},
''
,
''
,
308
,
{
'Range'
:
'bytes 0-2'
})
check
(
put
({
'Content-Range'
:
'bytes */*'
}),{},
''
,
''
,
R
308
,
{
'Range'
:
'bytes 0-2'
})
check
(
get
({
'Range'
:
'bytes=0-2'
}),{},
''
,
'abc'
,
206
,
{
'Content-Length'
:
'3'
,
'Content-Range'
:
'bytes 0-2/3'
})
# and .data should remain str after access (though later this could be
...
...
@@ -272,7 +281,7 @@ class TestBigFile(ERP5TypeTestCase):
self
.
assertEqual
(
f
.
getSize
(),
4
)
self
.
assertEqual
(
f
.
getData
(),
'abcd'
)
check
(
get
(),
{
'format'
:
'raw'
},
''
,
'abcd'
,
200
,
{
'Content-Length'
:
'4'
})
check
(
put
({
'Content-Range'
:
'bytes */*'
}),{},
''
,
''
,
308
,
{
'Range'
:
'bytes 0-3'
})
check
(
put
({
'Content-Range'
:
'bytes */*'
}),{},
''
,
''
,
R
308
,
{
'Range'
:
'bytes 0-3'
})
check
(
get
({
'Range'
:
'bytes=0-3'
}),{},
''
,
'abcd'
,
206
,
{
'Content-Length'
:
'4'
,
'Content-Range'
:
'bytes 0-3/4'
})
...
...
@@ -303,7 +312,7 @@ class TestBigFile(ERP5TypeTestCase):
self
.
assertEqual
(
f
.
getSize
(),
0
)
self
.
assertIs
(
f
.
getData
(),
None
)
check
(
get
(),
{
'format'
:
'raw'
},
''
,
''
,
200
,
{
'Content-Length'
:
'0'
})
check
(
put
({
'Content-Range'
:
'bytes */*'
}),{},
''
,
''
,
308
,
{
'Range'
:
'bytes 0--1'
})
# XXX 0--1 ok?
check
(
put
({
'Content-Range'
:
'bytes */*'
}),{},
''
,
''
,
R
308
,
{
'Range'
:
'bytes 0--1'
})
# XXX 0--1 ok?
check
(
get
({
'Range'
:
'bytes=0-0'
}),{},
''
,
''
,
416
,
{
'Content-Length'
:
'0'
,
'Content-Range'
:
'bytes */0'
})
...
...
@@ -314,7 +323,7 @@ class TestBigFile(ERP5TypeTestCase):
self
.
assertEqual
(
f
.
getSize
(),
1
)
self
.
assertEqual
(
f
.
getData
(),
'x'
)
check
(
get
(),
{
'format'
:
'raw'
},
''
,
'x'
,
200
,
{
'Content-Length'
:
'1'
})
check
(
put
({
'Content-Range'
:
'bytes */*'
}),{},
''
,
''
,
308
,
{
'Range'
:
'bytes 0-0'
})
check
(
put
({
'Content-Range'
:
'bytes */*'
}),{},
''
,
''
,
R
308
,
{
'Range'
:
'bytes 0-0'
})
check
(
get
({
'Range'
:
'bytes=0-3'
}),{},
''
,
'x'
,
206
,
{
'Content-Length'
:
'1'
,
'Content-Range'
:
'bytes 0-0/1'
})
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testAutoLogout.py
View file @
2eec2f13
...
...
@@ -34,8 +34,10 @@ import unittest
import
urllib
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
DateTime
import
DateTime
from
ZPublisher.cookie
import
normalizeCookieParameterName
try
:
from
ZPublisher.cookie
import
normalizeCookieParameterName
except
ImportError
:
# BBB Zope2
normalizeCookieParameterName
=
lambda
s
:
s
class
TestAuoLogout
(
ERP5TypeTestCase
):
"""
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testCookieCrumbler.py
View file @
2eec2f13
...
...
@@ -23,7 +23,10 @@ from AccessControl.User import UserFolder
from
Products.CMFCore.CookieCrumbler
import
CookieCrumbler
from
Products.CMFCore.tests.test_CookieCrumbler
import
makerequest
from
Products.CMFCore.tests.test_CookieCrumbler
import
CookieCrumblerTests
from
Products.CMFCore.tests.test_CookieCrumbler
import
normalizeCookieParameterName
try
:
from
Products.CMFCore.tests.test_CookieCrumbler
import
normalizeCookieParameterName
except
ImportError
:
# BBB Zope2
normalizeCookieParameterName
=
lambda
s
:
s
class
ERP5CookieCrumblerTests
(
CookieCrumblerTests
):
""" Modify original CMFCore Cookie Crumbler unit test to test long login """
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testERP5Type.py
View file @
2eec2f13
...
...
@@ -51,7 +51,7 @@ from AccessControl import Unauthorized
from
AccessControl.ZopeGuards
import
guarded_getattr
,
guarded_hasattr
from
Products.ERP5Type.tests.utils
import
createZODBPythonScript
from
Products.ERP5Type.tests.utils
import
removeZODBPythonScript
from
Products.ERP5Type
import
Permissions
from
Products.ERP5Type
import
IS_ZOPE2
,
Permissions
from
DateTime
import
DateTime
class
PropertySheetTestCase
(
ERP5TypeTestCase
):
...
...
@@ -3282,9 +3282,39 @@ def test_suite():
add_tests
(
suite
,
ZPublisher
.
tests
.
testHTTPRangeSupport
)
import
ZPublisher.tests.testHTTPRequest
if
IS_ZOPE2
:
# BBB Zope2
# ERP5 processes requests as utf-8 by default, but we adjust this test assuming that
# default is iso-8859-15
def
forceISO885915DefaultRequestCharset
(
method
):
def
wrapped
(
self
):
from
ZPublisher
import
HTTPRequest
as
module
old_encoding
=
module
.
default_encoding
module
.
default_encoding
=
'iso-8859-15'
try
:
return
method
(
self
)
finally
:
module
.
default_encoding
=
old_encoding
return
wrapped
HTTPRequestTests
=
ZPublisher
.
tests
.
testHTTPRequest
.
HTTPRequestTests
for
e
in
dir
(
HTTPRequestTests
):
if
e
.
startswith
(
'test_'
):
setattr
(
HTTPRequestTests
,
e
,
forceISO885915DefaultRequestCharset
(
getattr
(
HTTPRequestTests
,
e
)))
add_tests
(
suite
,
ZPublisher
.
tests
.
testHTTPRequest
)
import
ZPublisher.tests.testHTTPResponse
if
IS_ZOPE2
:
# BBB Zope2
# ERP5 forces utf-8 responses by default, but we adjust these tests so that they run
# with iso-8859-15 as default response charset
def
forceISO885915DefaultResponseCharset
(
method
):
def
wrapped
(
self
):
# here we can use this utility method which clean up at teardown
self
.
_setDefaultEncoding
(
'iso-8859-15'
)
return
method
(
self
)
return
wrapped
HTTPResponseTests
=
ZPublisher
.
tests
.
testHTTPResponse
.
HTTPResponseTests
for
e
in
dir
(
HTTPResponseTests
):
if
e
.
startswith
(
'test_'
):
setattr
(
HTTPResponseTests
,
e
,
forceISO885915DefaultResponseCharset
(
getattr
(
HTTPResponseTests
,
e
)))
add_tests
(
suite
,
ZPublisher
.
tests
.
testHTTPResponse
)
import
ZPublisher.tests.testIterators
...
...
@@ -3293,20 +3323,35 @@ def test_suite():
import
ZPublisher.tests.testPostTraversal
add_tests
(
suite
,
ZPublisher
.
tests
.
testPostTraversal
)
if
IS_ZOPE2
:
# BBB Zope2
import
ZPublisher.tests.testPublish
add_tests
(
suite
,
ZPublisher
.
tests
.
testPublish
)
import
ZPublisher.tests.test_Converters
add_tests
(
suite
,
ZPublisher
.
tests
.
test_Converters
)
import
ZPublisher.tests.test_WSGIPublisher
add_tests
(
suite
,
ZPublisher
.
tests
.
test_WSGIPublisher
)
if
IS_ZOPE2
:
# BBB Zope2
# XXX don't run test_WSGIPublisher for now because too many failures
pass
else
:
import
ZPublisher.tests.test_WSGIPublisher
add_tests
(
suite
,
ZPublisher
.
tests
.
test_WSGIPublisher
)
import
ZPublisher.tests.test_mapply
add_tests
(
suite
,
ZPublisher
.
tests
.
test_mapply
)
import
ZPublisher.tests.test_pubevents
add_tests
(
suite
,
ZPublisher
.
tests
.
test_pubevents
)
import
ZPublisher.tests.test_utils
add_tests
(
suite
,
ZPublisher
.
tests
.
test_utils
)
if
IS_ZOPE2
:
# BBB Zope2
import
ZPublisher.tests.testpubevents
add_tests
(
suite
,
ZPublisher
.
tests
.
testpubevents
)
else
:
import
ZPublisher.tests.test_pubevents
add_tests
(
suite
,
ZPublisher
.
tests
.
test_pubevents
)
if
not
IS_ZOPE2
:
# BBB Zope2
pass
else
:
import
ZPublisher.tests.test_utils
add_tests
(
suite
,
ZPublisher
.
tests
.
test_utils
)
import
ZPublisher.tests.test_xmlrpc
add_tests
(
suite
,
ZPublisher
.
tests
.
test_xmlrpc
)
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testRestrictedPythonSecurity.py
View file @
2eec2f13
...
...
@@ -37,6 +37,7 @@ from Products.ERP5Type.tests.utils import createZODBPythonScript
from
Products.ERP5Type.tests.utils
import
removeZODBPythonScript
from
Products.ERP5Type.patches.Restricted
import
allow_class_attribute
from
Products.ERP5Type.patches.Restricted
import
(
pandas_black_list
,
dataframe_black_list
,
series_black_list
)
from
Products.ERP5Type
import
IS_ZOPE2
from
AccessControl
import
Unauthorized
from
AccessControl.ZopeGuards
import
Unauthorized
as
ZopeGuardsUnauthorized
...
...
@@ -844,8 +845,12 @@ def test_suite():
add_tests
(
suite
,
AccessControl
.
tests
.
test_safeiter
)
import
AccessControl.tests.test_tainted
add_tests
(
suite
,
AccessControl
.
tests
.
test_tainted
)
import
AccessControl.tests.test_safe_formatter
add_tests
(
suite
,
AccessControl
.
tests
.
test_safe_formatter
)
if
IS_ZOPE2
:
# BBB Zope2
import
AccessControl.tests.test_formatter
add_tests
(
suite
,
AccessControl
.
tests
.
test_formatter
)
else
:
import
AccessControl.tests.test_safe_formatter
add_tests
(
suite
,
AccessControl
.
tests
.
test_safe_formatter
)
import
AccessControl.tests.test_userfolder
add_tests
(
suite
,
AccessControl
.
tests
.
test_userfolder
)
import
AccessControl.tests.test_users
...
...
bt5/erp5_corporate_identity_test/TestTemplateItem/portal_components/test.erp5.testCorporateIdentityTemplateList.py
View file @
2eec2f13
...
...
@@ -31,7 +31,7 @@ from PIL import Image
import
cStringIO
import
math
import
os.path
from
lxml.html
import
fromstring
,
tostring
def
changeSkin
(
skin_name
):
"""
...
...
@@ -212,8 +212,8 @@ class TestCorporateIdentityTemplateList(ERP5TypeTestCase):
expected_page
.
edit
(
text_content
=
html
)
self
.
tic
()
self
.
assertEqual
(
html
.
encode
(
'UTF-8'
),
#.splitlines(
),
expected_page
.
getData
())
#.splitlines(
))
tostring
(
fromstring
(
html
),
method
=
'c14n'
),
tostring
(
fromstring
(
expected_page
.
getData
().
decode
(
'utf-8'
)),
method
=
'c14n'
))
def
runPdfTestPattern
(
self
,
id1
,
id2
,
id3
,
**
kw
):
"""
...
...
bt5/erp5_maileva_connector/TestTemplateItem/portal_components/test.erp5.testMailevaSOAPConnector.py
View file @
2eec2f13
...
...
@@ -310,7 +310,7 @@ class testMailevaSOAPConnector(ERP5TypeTestCase):
def
test_maileva_xml
(
self
):
xml
=
self
.
maileva_connector
.
generateRequestXML
(
self
.
recipient
,
self
.
sender
,
self
.
document
,
'test_track_id'
)
self
.
assertEqual
(
xml
,
''' <SOAP-ENV:Envelope xmlns:ns0="http://connector.services.siclv2.maileva.fr/" xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:com="http://www.maileva.fr/CommonSchema" xmlns:pjs="http://www.maileva.fr/MailevaPJSSchema" xmlns:spec="http://www.maileva.fr/MailevaSpecificSchema">
self
.
assertEqual
(
etree
.
tostring
(
etree
.
fromstring
(
xml
)),
etree
.
tostring
(
etree
.
fromstring
(
''' <SOAP-ENV:Envelope xmlns:ns0="http://connector.services.siclv2.maileva.fr/" xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:com="http://www.maileva.fr/CommonSchema" xmlns:pjs="http://www.maileva.fr/MailevaPJSSchema" xmlns:spec="http://www.maileva.fr/MailevaSpecificSchema">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<ns0:submit>
...
...
@@ -410,7 +410,7 @@ class testMailevaSOAPConnector(ERP5TypeTestCase):
</ns0:submit>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
'''
%
(
self
.
document
.
getTitle
(),
self
.
document
.
getTitle
())
'''
%
(
self
.
document
.
getTitle
(),
self
.
document
.
getTitle
())
))
)
def
test_maileva_request_validation
(
self
):
...
...
product/CMFActivity/tests/testCMFActivity.py
View file @
2eec2f13
...
...
@@ -1546,7 +1546,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor):
# on REQUEST information when the method was activated.
request
=
self
.
portal
.
REQUEST
request
.
setServerURL
(
'http'
,
'test.erp5.org'
,
9080
)
request
.
setServerURL
(
'http'
,
'test.erp5.org'
,
'9080'
)
request
.
other
[
'PARENTS'
]
=
[
self
.
portal
.
organisation_module
]
request
.
setVirtualRoot
(
'virtual_root'
)
...
...
@@ -1565,7 +1565,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor):
# Reset server URL and virtual root before executing messages.
# This simulates the case of activities beeing executed with different
# REQUEST, such as TimerServer.
request
.
setServerURL
(
'https'
,
'anotherhost.erp5.org'
,
443
)
request
.
setServerURL
(
'https'
,
'anotherhost.erp5.org'
,
'443'
)
request
.
other
[
'PARENTS'
]
=
[
self
.
app
]
request
.
setVirtualRoot
(
''
)
# obviously, the object url is different
...
...
product/ERP5Type/tests/ERP5TypeLiveTestCase.py
View file @
2eec2f13
...
...
@@ -95,7 +95,7 @@ class ERP5TypeLiveTestCase(ERP5TypeTestCaseMixin):
host
,
port
=
self
.
_server_address
environ
=
{
'SERVER_NAME'
:
host
,
'SERVER_PORT'
:
port
,
'SERVER_PORT'
:
str
(
port
)
,
}
portal
=
getattr
(
makerequest
(
aq_base
(
site
.
aq_parent
),
environ
=
environ
),
...
...
product/ERP5Type/tests/ERP5TypeTestCase.py
View file @
2eec2f13
...
...
@@ -975,7 +975,7 @@ class ERP5TypeCommandLineTestCase(ERP5TypeTestCaseMixin):
if
self
.
_server_address
:
host
,
port
=
self
.
_server_address
environ
[
'SERVER_NAME'
]
=
host
environ
[
'SERVER_PORT'
]
=
port
environ
[
'SERVER_PORT'
]
=
str
(
port
)
app
=
makerequest
(
app
,
environ
=
environ
)
registry
.
register
(
app
)
...
...
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