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

'empty_call' unit tests failing on some libraries #791

Closed
busunkim96 opened this issue Feb 26, 2021 · 0 comments
Closed

'empty_call' unit tests failing on some libraries #791

busunkim96 opened this issue Feb 26, 2021 · 0 comments
Labels
🚨 This issue needs some love. triage me I really want to be triaged.

Comments

@busunkim96
Copy link
Contributor

https://source.cloud.google.com/results/invocations/a8592aaa-9284-46c8-b2a1-0abbecbd3e08/targets/cloud-devrel%2Fclient-libraries%2Fpython%2Fgoogleapis%2Fpython-secret-manager%2Fpresubmit%2Fpresubmit/log

=========================== short test summary info ============================
FAILED tests/unit/gapic/secretmanager_v1/test_secret_manager_service.py::test_set_iam_policy_empty_call
FAILED tests/unit/gapic/secretmanager_v1/test_secret_manager_service.py::test_get_iam_policy_empty_call
FAILED tests/unit/gapic/secretmanager_v1/test_secret_manager_service.py::test_test_iam_permissions_empty_call
FAILED tests/unit/gapic/secretmanager_v1beta1/test_secret_manager_service.py::test_set_iam_policy_empty_call
FAILED tests/unit/gapic/secretmanager_v1beta1/test_secret_manager_service.py::test_get_iam_policy_empty_call
FAILED tests/unit/gapic/secretmanager_v1beta1/test_secret_manager_service.py::test_test_iam_permissions_empty_call
6 failed, 432 passed in 6.87s
________________________ test_set_iam_policy_empty_call ________________________

    def test_set_iam_policy_empty_call():
        # This test is a coverage failsafe to make sure that totally empty calls,
        # i.e. request == None and no flattened fields passed, work.
        client = SecretManagerServiceClient(
            credentials=credentials.AnonymousCredentials(), transport="grpc",
        )

        # Mock the actual call within the gRPC stub, and fake the request.
        with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call:
>           client.set_iam_policy()

tests/unit/gapic/secretmanager_v1/test_secret_manager_service.py:3539:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <google.cloud.secretmanager_v1.services.secret_manager_service.client.SecretManagerServiceClient object at 0x7fe0d352c850>
request = None

    def set_iam_policy(
        self,
        request: iam_policy.SetIamPolicyRequest = None,
        *,
        retry: retries.Retry = gapic_v1.method.DEFAULT,
        timeout: float = None,
        metadata: Sequence[Tuple[str, str]] = (),
    ) -> policy.Policy:
        r"""Sets the access control policy on the specified secret. Replaces
        any existing policy.

        Permissions on
        [SecretVersions][google.cloud.secretmanager.v1.SecretVersion]
        are enforced according to the policy set on the associated
        [Secret][google.cloud.secretmanager.v1.Secret].

        Args:
            request (google.iam.v1.iam_policy_pb2.SetIamPolicyRequest):
                The request object. Request message for `SetIamPolicy`
                method.

            retry (google.api_core.retry.Retry): Designation of what errors, if any,
                should be retried.
            timeout (float): The timeout for this request.
            metadata (Sequence[Tuple[str, str]]): Strings which should be
                sent along with the request as metadata.

        Returns:
            google.iam.v1.policy_pb2.Policy:
                Defines an Identity and Access Management (IAM) policy. It is used to
                   specify access control policies for Cloud Platform
                   resources.

                   A Policy is a collection of bindings. A binding binds
                   one or more members to a single role. Members can be
                   user accounts, service accounts, Google groups, and
                   domains (such as G Suite). A role is a named list of
                   permissions (defined by IAM or configured by users).
                   A binding can optionally specify a condition, which
                   is a logic expression that further constrains the
                   role binding based on attributes about the request
                   and/or target resource.

                   **JSON Example**

                      {
                         "bindings": [
                            {
                               "role":
                               "roles/resourcemanager.organizationAdmin",
                               "members": [ "user:mike@example.com",
                               "group:admins@example.com",
                               "domain:google.com",
                               "serviceAccount:my-project-id@appspot.gserviceaccount.com"
                               ]

                            }, { "role":
                            "roles/resourcemanager.organizationViewer",
                            "members": ["user:eve@example.com"],
                            "condition": { "title": "expirable access",
                            "description": "Does not grant access after
                            Sep 2020", "expression": "request.time <
                            timestamp('2020-10-01T00:00:00.000Z')", } }

                         ]

                      }

                   **YAML Example**

                      bindings: - members: - user:\ mike@example.com -
                      group:\ admins@example.com - domain:google.com -
                      serviceAccount:\ my-project-id@appspot.gserviceaccount.com
                      role: roles/resourcemanager.organizationAdmin -
                      members: - user:\ eve@example.com role:
                      roles/resourcemanager.organizationViewer
                      condition: title: expirable access description:
                      Does not grant access after Sep 2020 expression:
                      request.time <
                      timestamp('2020-10-01T00:00:00.000Z')

                   For a description of IAM and its features, see the
                   [IAM developer's
                   guide](\ https://cloud.google.com/iam/docs).

        """
        # Create or coerce a protobuf request object.

        # The request isn't a proto-plus wrapped type,
        # so it must be constructed via keyword expansion.
        if isinstance(request, dict):
            request = iam_policy.SetIamPolicyRequest(**request)

        # Wrap the RPC method; this adds retry and timeout information,
        # and friendly error handling.
        rpc = self._transport._wrapped_methods[self._transport.set_iam_policy]

        # Certain fields should be provided within the metadata header;
        # add these here.
        metadata = tuple(metadata) + (
>           gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)),
        )
E       AttributeError: 'NoneType' object has no attribute 'resource'

google/cloud/secretmanager_v1/services/secret_manager_service/client.py:1510: AttributeError
@yoshi-automation yoshi-automation added triage me I really want to be triaged. 🚨 This issue needs some love. labels Feb 28, 2021
software-dov added a commit to software-dov/gapic-generator-python that referenced this issue Mar 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚨 This issue needs some love. triage me I really want to be triaged.
Projects
None yet
Development

No branches or pull requests

3 participants