Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
894ba313
Commit
894ba313
authored
Apr 07, 2006
by
Paul Winkler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed makerequest to not use os.environ by default.
parent
f90e41c1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
+8
-7
lib/python/Testing/makerequest.py
lib/python/Testing/makerequest.py
+8
-7
No files found.
lib/python/Testing/makerequest.py
View file @
894ba313
...
...
@@ -19,12 +19,15 @@ Usage:
import makerequest
app = makerequest.makerequest(Zope2.app())
You can optionally pass stdout to be used by the response,
and an environ mapping to be used in the request.
Defaults are sys.stdout and os.environ.
You can optionally pass stdout to be used by the response;
default is sys.stdout.
You can optionally pass an environ mapping to be used in the request.
Default is a fresh dictionary. Passing os.environ is not recommended;
tests should not pollute the real os.environ.
If you don't want to start a zope app in your test, you can wrap other
objects, but
they
must support acquisition and you should only wrap
objects, but
it
must support acquisition and you should only wrap
your root object.
...
...
@@ -38,10 +41,8 @@ from ZPublisher.HTTPRequest import HTTPRequest
from
ZPublisher.HTTPResponse
import
HTTPResponse
from
ZPublisher.BaseRequest
import
RequestContainer
def
makerequest
(
app
,
stdout
=
stdout
,
environ
=
None
):
def
makerequest
(
app
,
stdout
=
stdout
,
environ
=
{}
):
resp
=
HTTPResponse
(
stdout
=
stdout
)
if
environ
is
None
:
environ
=
os
.
environ
environ
.
setdefault
(
'SERVER_NAME'
,
'foo'
)
environ
.
setdefault
(
'SERVER_PORT'
,
'80'
)
environ
.
setdefault
(
'REQUEST_METHOD'
,
'GET'
)
...
...
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