Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixing tests so that they will all pass again. Also fixing for compat…

…ibility with crank. Had to convert all incoming values from the XMLRPC request body so that I could pass along values to crank, and allow the code to work properly.
  • Loading branch information...
commit 97e635d9aeea0d83b9294757416aa27ac402839c 1 parent 561e9a4
@pedersen pedersen authored
View
3  .hgignore
@@ -3,3 +3,6 @@ syntax:glob
*.pyc
*.wpu
dist/*
+.coverage
+nosetests.xml
+
View
4 tgext/xmlrpc/controllers.py
@@ -26,7 +26,7 @@ def __call__(self, func):
deco.helpstr = self.helpstr
exposed.register_template_engine(\
'text/xml', config.get('default_renderer', ['mako'])[0],
- '', [])
+ '', [], {})
return deco
def wrap(self, func, *p, **kw):
@@ -157,7 +157,7 @@ def _dispatch(self, state, remainder, parms=None, method=None):
if method:
if getattr(method, 'signatures', None) is not None:
state.add_method(method, [])
- state.remainder = ['' for x in parms]
+ state.remainder = [str(x) for x in parms]
return state
else:
state.add_method(self.rpcfault, ['Invalid XMLRPC Method'])
View
1  tgext/xmlrpc/test/__init__.py
@@ -0,0 +1 @@
+import lib
View
4 tgext/xmlrpc/test/controllers/root.py
@@ -16,7 +16,7 @@ class TestRpcController(XmlRpcController):
def addit(self, *p, **kw):
return sum(p)
- @xmlrpc([['int', 'array']], helpstr='sums two numbers')
+ @xmlrpc([['int', 'int']], helpstr='sums two numbers')
def sumthem(self, num1, num2, *p, **kw):
return num1+num2
@@ -33,4 +33,4 @@ def index(self, *p, **kw):
return 'hello world'
xmlrpc = TestRpcController()
-
+
View
1  tgext/xmlrpc/test/lib/__init__.py
@@ -0,0 +1 @@
+import app_globals
View
18 tgext/xmlrpc/test/lib/app_globals.py
@@ -0,0 +1,18 @@
+# -*- coding: utf-8 -*-
+
+"""The application's Globals object"""
+
+__all__ = ['Globals']
+
+
+class Globals(object):
+ """Container for objects available throughout the life of the application.
+
+ One instance of Globals is created during application initialization and
+ is available during requests via the 'app_globals' variable.
+
+ """
+
+ def __init__(self):
+ """Do nothing, by default."""
+ pass
View
48 tgext/xmlrpc/test/test_controller.py
@@ -1,9 +1,9 @@
import os, sys
import xmlrpclib
-from pylons import config
-from tg.test_stack import TestConfig, app_from_config
+from tg.configuration import AppConfig, config
from tg.util import Bunch
+from webtest import TestApp
import tgext.xmlrpc.test
@@ -16,21 +16,33 @@
templates=os.path.join(root, 'templates')
)
-base_config = TestConfig(folder = 'rendering',
- values = {'use_sqlalchemy': False,
- 'use_toscawidgets2': False,
- 'full_stack': False,
- 'pylons.helpers': Bunch(),
- 'renderers': ['genshi'],
- 'use_legacy_renderer': False,
- 'default_renderer':'genshi',
- 'use_dotted_templatenames': True,
- 'paths':paths,
- 'package':tgext.xmlrpc.test,
- 'beaker.session.secret': 'ChAnGeMe',
- 'beaker.session.key': 'tgext.xmlrpc.test',
- }
- )
+base_config = AppConfig()
+base_config.update(
+ {'use_sqlalchemy': False,
+ 'use_toscawidgets2': False,
+ 'full_stack': False,
+ 'pylons.helpers': Bunch(),
+ 'renderers': ['genshi'],
+ 'use_legacy_renderer': False,
+ 'default_renderer':'genshi',
+ 'use_dotted_templatenames': True,
+ 'paths':paths,
+ 'package':tgext.xmlrpc.test,
+ 'beaker.session.secret': 'ChAnGeMe',
+ 'beaker.session.key': 'tgext.xmlrpc.test',
+ }
+ )
+
+def app_from_config(base_config, deployment_config=None):
+ if not deployment_config:
+ deployment_config = {'debug': 'true',
+ 'error_email_from': 'paste@localhost',
+ 'smtp_server': 'localhost'}
+
+ env_loader = base_config.make_load_environment()
+ app_maker = base_config.setup_tg_wsgi_app(env_loader)
+ app = TestApp(app_maker(deployment_config, full_stack=True))
+ return app
class TestXmlRpcController:
def __init__(self):
@@ -115,4 +127,4 @@ def test_bad_xml_post(self):
def test_genfault(self):
resp = self.app.post('/xmlrpc', xmlrpclib.dumps((1,2), 'genfault'))
assert '<name>faultCode</name>' in resp, resp
-
+
Please sign in to comment.
Something went wrong with that request. Please try again.