Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Jérome Perrin
erp5
Commits
fd033a70
Commit
fd033a70
authored
May 31, 2016
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ERP5Type: xxx wip on publish
parent
189316b2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
29 deletions
+45
-29
product/ERP5Type/tests/ERP5TypeTestCase.py
product/ERP5Type/tests/ERP5TypeTestCase.py
+45
-29
No files found.
product/ERP5Type/tests/ERP5TypeTestCase.py
View file @
fd033a70
...
...
@@ -601,61 +601,77 @@ class ERP5TypeTestCaseMixin(ProcessingNodeTestCase, PortalTestCase):
def
publish
(
self
,
path
,
basic
=
None
,
env
=
None
,
extra
=
None
,
request_method
=
'GET'
,
stdin
=
None
,
handle_errors
=
True
):
'''Publishes the object at 'path' returning a response object.'''
'''Publishes the object at 'path' returning a response object.
This was copied from Zope.Testing.ZopeTestCase.functional and adjusted to:
* fix a problem with some passwords ( d8e87e7ab922cab4486a715e0a8ed2530c696cae )
* set HTTP_ACCEPT_CHARSET
* support live tests hacks
'''
from
ZPublisher.Response
import
Response
from
ZPublisher.Test
import
publish_module
from
AccessControl.SecurityManagement
import
getSecurityManager
from
AccessControl.SecurityManagement
import
setSecurityManager
from
zope.security.management
import
endInteraction
from
zope.security.management
import
restoreInteraction
request
=
self
.
app
.
REQUEST
# Save current security manager
sm
=
getSecurityManager
()
#endInteraction()
_module_cache_set
=
getattr
(
request
,
'_module_cache_set'
,
None
)
# Commit the sandbox for good measure
self
.
commit
()
try
:
# Commit the sandbox for good measure
self
.
commit
()
if
env
is
None
:
if
env
is
None
:
env
=
{}
if
extra
is
None
:
if
extra
is
None
:
extra
=
{}
request
=
self
.
app
.
REQUEST
env
[
'SERVER_NAME'
]
=
request
[
'SERVER_NAME'
]
env
[
'SERVER_PORT'
]
=
request
[
'SERVER_PORT'
]
env
[
'HTTP_ACCEPT_CHARSET'
]
=
request
[
'HTTP_ACCEPT_CHARSET'
]
env
[
'REQUEST_METHOD'
]
=
request_method
env
[
'SERVER_NAME'
]
=
request
[
'SERVER_NAME'
]
env
[
'SERVER_PORT'
]
=
request
[
'SERVER_PORT'
]
env
[
'HTTP_ACCEPT_CHARSET'
]
=
request
[
'HTTP_ACCEPT_CHARSET'
]
env
[
'REQUEST_METHOD'
]
=
request_method
p
=
path
.
split
(
'?'
)
if
len
(
p
)
==
1
:
p
=
path
.
split
(
'?'
)
if
len
(
p
)
==
1
:
env
[
'PATH_INFO'
]
=
p
[
0
]
elif
len
(
p
)
==
2
:
elif
len
(
p
)
==
2
:
[
env
[
'PATH_INFO'
],
env
[
'QUERY_STRING'
]]
=
p
else
:
else
:
raise
TypeError
,
''
if
basic
:
if
basic
:
env
[
'HTTP_AUTHORIZATION'
]
=
"Basic %s"
%
base64
.
encodestring
(
basic
).
replace
(
'
\
012
'
,
''
)
if
stdin
is
None
:
if
stdin
is
None
:
stdin
=
StringIO
()
outstream
=
StringIO
()
response
=
Response
(
stdout
=
outstream
,
stderr
=
sys
.
stderr
)
outstream
=
StringIO
()
response
=
Response
(
stdout
=
outstream
,
stderr
=
sys
.
stderr
)
publish_module
(
'Zope2'
,
response
=
response
,
stdin
=
stdin
,
environ
=
env
,
extra
=
extra
,
debug
=
not
handle_errors
,
)
publish_module
(
'Zope2'
,
response
=
response
,
stdin
=
stdin
,
environ
=
env
,
extra
=
extra
,
debug
=
not
handle_errors
,
)
# Restore security manager
setSecurityManager
(
sm
)
return
ResponseWrapper
(
response
,
outstream
,
path
)
finally
:
# Restore security manager
setSecurityManager
(
sm
)
#restoreInteraction()
if
_module_cache_set
is
not
None
:
print
"bah ouais"
,
_module_cache_set
request
.
_module_cache_set
=
_module_cache_set
return
ResponseWrapper
(
response
,
outstream
,
path
)
def
getConsistencyMessageList
(
self
,
obj
):
return
sorted
([
str
(
message
.
getMessage
())
...
...
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