Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UInt32Value is not supported in generated unit tests #1372

Closed
vam-google opened this issue Jul 26, 2022 · 0 comments · Fixed by #1437
Closed

UInt32Value is not supported in generated unit tests #1372

vam-google opened this issue Jul 26, 2022 · 0 comments · Fixed by #1437
Assignees
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@vam-google
Copy link
Contributor

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 vam-google self-assigned this Jul 26, 2022
@vam-google vam-google added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. priority: p2 Moderately-important priority. Fix may not be included in next release. labels Jul 26, 2022
vam-google added a commit to vam-google/gapic-generator-python that referenced this issue Sep 9, 2022
parthea added a commit that referenced this issue Sep 9, 2022
This fixes #1372

Co-authored-by: Anthonios Partheniou <partheniou@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant