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
f54fc698
Commit
f54fc698
authored
Jan 16, 2004
by
Tres Seaver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Merge test for Collector #1184
parent
5aeb67d3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
0 deletions
+53
-0
lib/python/ZPublisher/tests/test_xmlrpc.py
lib/python/ZPublisher/tests/test_xmlrpc.py
+53
-0
No files found.
lib/python/ZPublisher/tests/test_xmlrpc.py
0 → 100644
View file @
f54fc698
import
unittest
class
FauxResponse
:
def
__init__
(
self
):
self
.
_headers
=
{}
self
.
_body
=
None
def
setBody
(
self
,
body
):
self
.
_body
=
body
def
setHeader
(
self
,
name
,
value
):
self
.
_headers
[
name
]
=
value
class
FauxInstance
:
def
__init__
(
self
,
**
kw
):
self
.
__dict__
.
update
(
kw
)
class
XMLRPCResponseTests
(
unittest
.
TestCase
):
def
_getTargetClass
(
self
):
from
ZPublisher.xmlrpc
import
Response
return
Response
def
_makeOne
(
self
,
*
args
,
**
kw
):
return
self
.
_getTargetClass
()(
*
args
,
**
kw
)
def
test_setBody
(
self
):
import
xmlrpclib
body
=
FauxInstance
(
_secret
=
'abc'
,
public
=
'def'
)
faux
=
FauxResponse
()
response
=
self
.
_makeOne
(
faux
)
response
.
setBody
(
body
)
body_str
=
faux
.
_body
self
.
assertEqual
(
type
(
body_str
),
type
(
''
))
as_set
,
method
=
xmlrpclib
.
loads
(
body_str
)
as_set
=
as_set
[
0
]
self
.
assertEqual
(
method
,
None
)
self
.
failIf
(
'_secret'
in
as_set
.
keys
())
self
.
failUnless
(
'public'
in
as_set
.
keys
())
self
.
assertEqual
(
as_set
[
'public'
],
'def'
)
def
test_suite
():
return
unittest
.
TestSuite
((
unittest
.
makeSuite
(
XMLRPCResponseTests
),))
if
__name__
==
'__main__'
:
unittest
.
main
(
defaultTest
=
'test_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