Exemplo n.º 1
0
    def test_reidentify_content(self):
        # Setup Expected Response
        expected_response = {}
        expected_response = dlp_pb2.ReidentifyContentResponse(
            **expected_response)

        # Mock the API response
        channel = ChannelStub(responses=[expected_response])
        client = dlp_v2.DlpServiceClient(channel=channel)

        # Setup Request
        parent = client.project_path('[PROJECT]')

        response = client.reidentify_content(parent)
        assert expected_response == response

        assert len(channel.requests) == 1
        expected_request = dlp_pb2.ReidentifyContentRequest(parent=parent)
        actual_request = channel.requests[0][1]
        assert expected_request == actual_request
Exemplo n.º 2
0
    def test_reidentify_content(self):
        # Setup Expected Response
        expected_response = {}
        expected_response = dlp_pb2.ReidentifyContentResponse(**expected_response)

        # Mock the API response
        channel = ChannelStub(responses=[expected_response])
        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
        with patch as create_channel:
            create_channel.return_value = channel
            client = dlp_v2.DlpServiceClient()

        # Setup Request
        parent = client.project_path("[PROJECT]")

        response = client.reidentify_content(parent)
        assert expected_response == response

        assert len(channel.requests) == 1
        expected_request = dlp_pb2.ReidentifyContentRequest(parent=parent)
        actual_request = channel.requests[0][1]
        assert expected_request == actual_request