gapic-generator-python icon indicating copy to clipboard operation
gapic-generator-python copied to clipboard

UInt32Value is not supported in generated unit tests

Open vam-google opened this issue 2 years ago • 0 comments

It seems like there are issues in properly handliing Value classes by proto_plus.

Affected APIs:

//google/cloud/bigquery/connection/v1beta1/connection_py_gapic_test
//google/cloud/bigquery/v2/bigquery_py_gapic_test

Failure output:

google/cloud/bigquery/connection/v1beta1/connection_py_gapic_srcjar.py/tests/unit/gapic/connection_v1beta1/test_connection_service.py:1231: AssertionError
____________________ test_list_connections_flattened_async _____________________

    @pytest.mark.asyncio
    async def test_list_connections_flattened_async():
        client = ConnectionServiceAsyncClient(
            credentials=ga_credentials.AnonymousCredentials(),
        )
    
        # Mock the actual call within the gRPC stub, and fake the request.
        with mock.patch.object(
                type(client.transport.list_connections),
                '__call__') as call:
            # Designate an appropriate return value for the call.
            call.return_value = connection.ListConnectionsResponse()
    
            call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(connection.ListConnectionsResponse())
            # Call the method with a truthy value for each flattened field,
            # using the keyword arguments to the method.
            response = await client.list_connections(
                parent='parent_value',
                max_results=wrappers_pb2.UInt32Value(value=541),
            )
    
            # Establish that the underlying call was made with the expected
            # request object values.
            assert len(call.mock_calls)
            _, args, _ = call.mock_calls[0]
            arg = args[0].parent
            mock_val = 'parent_value'
            assert arg == mock_val
            arg = args[0].max_results
            mock_val = wrappers_pb2.UInt32Value(value=541)
>           assert arg == mock_val
E           assert 541 == value: 541\n

google/cloud/bigquery/connection/v1beta1/connection_py_gapic_srcjar.py/tests/unit/gapic/connection_v1beta1/test_connection_service.py:1278: AssertionError
=========================== short test summary info ============================
FAILED google/cloud/bigquery/connection/v1beta1/connection_py_gapic_srcjar.py/tests/unit/gapic/connection_v1beta1/test_connection_service.py::test_list_connections_flattened
FAILED google/cloud/bigquery/connection/v1beta1/connection_py_gapic_srcjar.py/tests/unit/gapic/connection_v1beta1/test_connection_service.py::test_list_connections_flattened_async
2 failed, 171 passed, 39 warnings in 1.15s

vam-google avatar Jul 26 '22 22:07 vam-google