예제 #1
0
    def testFullExecutor(self, ssl):
        bridge = _DummyBridge()
        with constructClient(self.log, bridge, ssl) as clientFactory:
            with self._client(clientFactory) as client:
                with self.assertRaises(JsonRpcErrorBase) as cm:
                    self._callTimeout(client, "no_method", [], CALL_ID)

                self.assertEqual(cm.exception.code,
                                 JsonRpcInternalError().code)
예제 #2
0
    def testMethodBadParameters(self, ssl):
        # Without a schema the server returns an internal error

        bridge = _DummyBridge()
        with constructClient(self.log, bridge, ssl) as clientFactory:
            with self._client(clientFactory) as client:
                with self.assertRaises(JsonRpcErrorBase) as cm:
                    self._callTimeout(client, "echo", [], CALL_ID)

                self.assertEqual(cm.exception.code,
                                 JsonRpcInternalError().code)
예제 #3
0
    def testFullExecutor(self, ssl, type):
        bridge = _DummyBridge()
        with constructClient(self.log, bridge, ssl, type) as clientFactory:
            with self._client(clientFactory) as client:
                if type == "xml":
                    # TODO start using executor for xmlrpc
                    pass
                else:
                    with self.assertRaises(JsonRpcError) as cm:
                        self._callTimeout(client, "no_method", [], CALL_ID)

                    self.assertEquals(cm.exception.code,
                                      JsonRpcInternalError().code)
예제 #4
0
    def testMethodBadParameters(self, reactorType):
        # Without a schema the server returns an internal error

        bridge = _DummyBridge()
        with constructServer(reactorType, bridge) as (server, clientFactory):
            client = clientFactory()
            client.connect()
            with closing(client):
                with self.assertRaises(JsonRpcError) as cm:
                    client.callMethod("echo", [], 10, timeout=CALL_TIMEOUT)

                self.assertEquals(cm.exception.code,
                                  JsonRpcInternalError().code)
예제 #5
0
    def testMethodBadParameters(self, rt, ssl):
        # Without a schema the server returns an internal error

        bridge = _DummyBridge()
        with constructServer(rt, bridge, ssl) as (server, clientFactory):
            with self._client(clientFactory) as client:
                with self.assertRaises(JsonRpcError) as cm:
                    self._callTimeout(client,
                                      "echo", [],
                                      apiTests.id,
                                      timeout=CALL_TIMEOUT)

                self.assertEquals(cm.exception.code,
                                  JsonRpcInternalError().code)
예제 #6
0
    def testMethodBadParameters(self, ssl, type):
        # Without a schema the server returns an internal error

        bridge = _DummyBridge()
        with constructClient(self.log, bridge, ssl, type) as clientFactory:
            with self._client(clientFactory) as client:
                if type == "xml":
                    response = client.send("echo", ())
                    self.assertTrue(
                        "echo() takes exactly 2 arguments" in response)
                else:
                    with self.assertRaises(JsonRpcError) as cm:
                        self._callTimeout(client, "echo", [], CALL_ID)

                    self.assertEquals(cm.exception.code,
                                      JsonRpcInternalError().code)