Beispiel #1
0
    def test_delete_reference_image(self):
        channel = ChannelStub()
        client = vision_v1.ProductSearchClient(channel=channel)

        # Setup Request
        name = client.image_path('[PROJECT]', '[LOCATION]', '[PRODUCT]',
                                 '[IMAGE]')

        client.delete_reference_image(name)

        assert len(channel.requests) == 1
        expected_request = product_search_service_pb2.DeleteReferenceImageRequest(
            name=name)
        actual_request = channel.requests[0][1]
        assert expected_request == actual_request
    def test_delete_reference_image(self):
        channel = ChannelStub()
        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
        with patch as create_channel:
            create_channel.return_value = channel
            client = vision_v1.ProductSearchClient()

        # Setup Request
        name = client.reference_image_path("[PROJECT]", "[LOCATION]",
                                           "[PRODUCT]", "[REFERENCE_IMAGE]")

        client.delete_reference_image(name)

        assert len(channel.requests) == 1
        expected_request = product_search_service_pb2.DeleteReferenceImageRequest(
            name=name)
        actual_request = channel.requests[0][1]
        assert expected_request == actual_request