[Zope3-checkins] CVS: Zope3/src/zope/app/publisher/xmlrpc/tests -
test_directives.py:1.7 xmlrpc.zcml:1.3 xmlrpc_error.zcml:1.3
Stephan Richter
srichter at cosmos.phy.tufts.edu
Mon Aug 4 20:19:49 EDT 2003
Update of /cvs-repository/Zope3/src/zope/app/publisher/xmlrpc/tests
In directory cvs.zope.org:/tmp/cvs-serv1822/src/zope/app/publisher/xmlrpc/tests
Modified Files:
test_directives.py xmlrpc.zcml xmlrpc_error.zcml
Log Message:
After wanting to fix XML-RPC for over a year, I finally got around to do
it. You can now specify view names, create default views and of course you
do not have access to the object's methods directly anymore.
Added some tests for all of this.
Updated XML-RPC directives. Made them also a bit more consistent with the
browser ones.
This should make the XML-RPC code ready for the beta.
=== Zope3/src/zope/app/publisher/xmlrpc/tests/test_directives.py 1.6 => 1.7 ===
--- Zope3/src/zope/app/publisher/xmlrpc/tests/test_directives.py:1.6 Sun Aug 3 19:47:51 2003
+++ Zope3/src/zope/app/publisher/xmlrpc/tests/test_directives.py Mon Aug 4 19:19:14 2003
@@ -20,7 +20,7 @@
from zope.configuration import xmlconfig
from zope.configuration.exceptions import ConfigurationError
from zope.component.tests.views import IC, V1
-from zope.component import getView, queryView
+from zope.component import getView, queryView, getDefaultViewName
from zope.app.tests.placelesssetup import PlacelessSetup
from zope.security.proxy import ProxyFactory
from cStringIO import StringIO
@@ -47,7 +47,6 @@
context = xmlconfig.file("xmlrpc.zcml", xmlrpc.tests)
self.assertEqual(queryView(ob, 'test', request).__class__, V1)
-
def testInterfaceProtectedView(self):
context = xmlconfig.file("xmlrpc.zcml", xmlrpc.tests)
v = getView(ob, 'test2', request)
@@ -55,7 +54,6 @@
self.assertEqual(v.index(), 'V1 here')
self.assertRaises(Exception, getattr, v, 'action')
-
def testAttributeProtectedView(self):
context = xmlconfig.file("xmlrpc.zcml", xmlrpc.tests)
v = getView(ob, 'test3', request)
@@ -63,55 +61,25 @@
self.assertEqual(v.action(), 'done')
self.assertRaises(Exception, getattr, v, 'index')
-
def testInterfaceAndAttributeProtectedView(self):
context = xmlconfig.file("xmlrpc.zcml", xmlrpc.tests)
v = getView(ob, 'test4', request)
self.assertEqual(v.index(), 'V1 here')
self.assertEqual(v.action(), 'done')
-
def testDuplicatedInterfaceAndAttributeProtectedView(self):
context = xmlconfig.file("xmlrpc.zcml", xmlrpc.tests)
v = getView(ob, 'test5', request)
self.assertEqual(v.index(), 'V1 here')
self.assertEqual(v.action(), 'done')
-
def testIncompleteProtectedViewNoPermission(self):
self.assertRaises(ConfigurationError, xmlconfig.file,
"xmlrpc_error.zcml", xmlrpc.tests)
-
- def testMethodViews(self):
- context = xmlconfig.file("xmlrpc.zcml", xmlrpc.tests)
- v = getView(ob, 'index2.html', request)
- self.assertEqual(v(), 'V1 here')
- v = getView(ob, 'action2.html', request)
- self.assertEqual(v(), 'done')
-
-
- def testMethodViewsWithName(self):
- context = xmlconfig.file("xmlrpc.zcml", xmlrpc.tests)
- v = getView(ob, 'index3.html', request)
- self.assertEqual(v(), 'V1 here')
- v = getView(ob, 'action3.html', request)
- self.assertEqual(v(), 'done')
- v = getView(ob, 'test', request)
- self.assertEqual(v.index(), 'V1 here')
- self.assertEqual(v.action(), 'done')
-
-
- def testProtectedMethodViews(self):
+ def testDefaultView(self):
context = xmlconfig.file("xmlrpc.zcml", xmlrpc.tests)
- # Need to "log someone in" to turn on checks
- from zope.security.management import newSecurityManager
- newSecurityManager('someuser')
-
- v = getView(ob, 'index4.html', request)
- self.assertRaises(Exception, v)
- v = getView(ob, 'action4.html', request)
- self.assertEqual(v(), 'done')
+ self.assertEqual(getDefaultViewName(ob, request), 'test')
def test_suite():
=== Zope3/src/zope/app/publisher/xmlrpc/tests/xmlrpc.zcml 1.2 => 1.3 ===
--- Zope3/src/zope/app/publisher/xmlrpc/tests/xmlrpc.zcml:1.2 Sun Aug 3 20:15:49 2003
+++ Zope3/src/zope/app/publisher/xmlrpc/tests/xmlrpc.zcml Mon Aug 4 19:19:14 2003
@@ -7,66 +7,41 @@
<xmlrpc:view
name="test"
- factory="zope.component.tests.views.V1"
+ class="zope.component.tests.views.V1"
for="zope.component.tests.views.IC" />
<xmlrpc:view
name="test2"
- factory="zope.component.tests.views.V1"
+ class="zope.component.tests.views.V1"
for="zope.component.tests.views.IC"
permission="zope.Public"
allowed_interface="zope.component.tests.views.IV" />
- <xmlrpc:view name="test3"
- factory="zope.component.tests.views.V1"
+ <xmlrpc:view
+ name="test3"
+ class="zope.component.tests.views.V1"
for="zope.component.tests.views.IC"
permission="zope.Public"
- allowed_methods="action" />
+ allowed_attributes="action" />
- <xmlrpc:view name="test4"
- factory="zope.component.tests.views.V1"
+ <xmlrpc:view
+ name="test4"
+ class="zope.component.tests.views.V1"
for="zope.component.tests.views.IC"
permission="zope.Public"
- allowed_methods="action"
+ allowed_attributes="action"
allowed_interface="zope.component.tests.views.IV" />
<xmlrpc:view
name="test5"
- factory="zope.component.tests.views.V1"
+ class="zope.component.tests.views.V1"
for="zope.component.tests.views.IC"
permission="zope.Public"
- allowed_methods="action index"
+ allowed_attributes="action index"
allowed_interface="zope.component.tests.views.IV" />
- <xmlrpc:view
- factory="zope.component.tests.views.V1"
- for="zope.component.tests.views.IC">
-
- <xmlrpc:method name="index2.html" attribute="index" />
- <xmlrpc:method name="action2.html" attribute="action" />
-
- </xmlrpc:view>
-
-
- <xmlrpc:view name="test6"
- factory="zope.component.tests.views.V1"
- for="zope.component.tests.views.IC">
-
- <xmlrpc:method name="index3.html" attribute="index" />
- <xmlrpc:method name="action3.html" attribute="action" />
-
- </xmlrpc:view>
-
- <permission id="zope.XXX" title="xxx" />
-
- <xmlrpc:view
- factory="zope.component.tests.views.V1"
- for="zope.component.tests.views.IC"
- permission="zope.XXX">
-
- <xmlrpc:method name="index4.html" attribute="index" />
- <xmlrpc:method name="action4.html" attribute="action"
- permission="zope.Public" />
- </xmlrpc:view>
+ <xmlrpc:defaultView
+ name="test"
+ for="zope.component.tests.views.IC" />
</configure>
=== Zope3/src/zope/app/publisher/xmlrpc/tests/xmlrpc_error.zcml 1.2 => 1.3 ===
--- Zope3/src/zope/app/publisher/xmlrpc/tests/xmlrpc_error.zcml:1.2 Sun Aug 3 20:15:49 2003
+++ Zope3/src/zope/app/publisher/xmlrpc/tests/xmlrpc_error.zcml Mon Aug 4 19:19:14 2003
@@ -8,6 +8,6 @@
name="test"
factory="zope.component.tests.views.V1"
for="zope.component.tests.views.IC"
- allowed_methods="action index" />
+ allowed_attributes="action index" />
</configure>
More information about the Zope3-Checkins
mailing list