Commits

Olemis Lang committed b22a6a5

BH RPC : Upgrade XML-RPC test cases to work with functional testers and RPC URL

  • Participants
  • Parent commits 9d82f54

Comments (0)

Files changed (1)

trunk/tracrpc/tests/xml_rpc.py

 
 import xmlrpclib
 
-from tracrpc.tests import rpc_testenv, TracRpcTestCase
+from tracrpc.tests import TracRpcTestCase
 
 class RpcXmlTestCase(TracRpcTestCase):
     
     def setUp(self):
         TracRpcTestCase.setUp(self)
-        self.anon = xmlrpclib.ServerProxy(rpc_testenv.url_anon)
-        self.user = xmlrpclib.ServerProxy(rpc_testenv.url_user)
-        self.admin = xmlrpclib.ServerProxy(rpc_testenv.url_admin)
+        self.anon = self._tester.server_proxy(self.url_anon)
+        self.user = self._tester.server_proxy(self.url_auth, user='user')
+        self.admin = self._tester.server_proxy(self.url_auth, user='admin')
 
     def tearDown(self):
         TracRpcTestCase.tearDown(self)
 
     def test_xmlrpc_permission(self):
         # Test returned response if not XML_RPC permission
-        rpc_testenv._tracadmin('permission', 'remove', 'anonymous',
+        self._testenv._tracadmin('permission', 'remove', 'anonymous',
                                 'XML_RPC', wait=True)
         e = self.assertRaises(xmlrpclib.Fault,
                     self.anon.system.listMethods)
         self.assertEquals(403, e.faultCode)
         self.assertTrue('XML_RPC' in e.faultString)
-        rpc_testenv._tracadmin('permission', 'add', 'anonymous',
+        self._testenv._tracadmin('permission', 'add', 'anonymous',
                                         'XML_RPC', wait=True)
 
     def test_method_not_found(self):
         self.assertEquals('Desc & ription', ticket[3]['description'])
         self.admin.ticket.delete(tid1)
 
-def test_suite():
-    return unittest.makeSuite(RpcXmlTestCase)
+def test_suite(suite=None):
+    if suite is None:
+        from tracrpc.tests import functionalSuite
+        suite = functionalSuite()
+    # FIXME: Improve
+    ts = unittest.makeSuite(RpcXmlTestCase)
+    for test in ts._tests:
+        suite.addTest(test)
+    return suite
+
 
 if __name__ == '__main__':
     unittest.main(defaultTest='test_suite')