Ejemplo n.º 1
0
    def test_executefunction(self):
        """
        Test ExecuteFunction ColumnOperations.

        This tests calls the ExecuteFunction function, with an
        id corresponding to the ColumnOperations plugin function.
        """

        header = SSE.FunctionRequestHeader(functionId=SUM_OF_ROWS_ID,
                                           version="1")

        duals = numbers_to_duals(1, 2, 3, 4, 5)
        rows = duals_to_rows(duals)

        # Trailing commas to make iterable sequences of tuples.
        bundled_rows = (SSE.BundledRows(rows=rows)),
        metadata = (('qlik-functionrequestheader-bin',
                     header.SerializeToString()), )

        result = self.stub.ExecuteFunction(request_iterator=iter(bundled_rows),
                                           metadata=metadata)

        for bundled_row in result:
            for row in bundled_row.rows:
                for dual in row.duals:
                    assert dual.numData == 15
Ejemplo n.º 2
0
    def test_executefunction(self):
        """
        Test ExecuteFunction HelloWorld.

        This tests calls the ExecuteFunction function, with an
        id corresponding to the HelloWorld plugin function.
        """

        header = SSE.FunctionRequestHeader(functionId=HELLO_WORLD_ID, version="1")

        duals = strings_to_duals('Hello World!')
        rows = duals_to_rows(duals)

        # Trailing commas to make iterable sequences of tuples.
        bundled_rows = (SSE.BundledRows(rows=rows)),
        metadata = (('qlik-functionrequestheader-bin', header.SerializeToString()),)

        result = self.stub.ExecuteFunction(request_iterator=iter(bundled_rows), metadata=metadata)

        for bundled_row in result:
            for row in bundled_row.rows:
                for dual in row.duals:
                    assert dual.strData == 'Hello World!'