예제 #1
0
    def test_delete_product(self):
        channel = ChannelStub()
        client = vision_v1.ProductSearchClient(channel=channel)

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

        client.delete_product(name)

        assert len(channel.requests) == 1
        expected_request = product_search_service_pb2.DeleteProductRequest(
            name=name)
        actual_request = channel.requests[0][1]
        assert expected_request == actual_request
예제 #2
0
    def test_delete_product(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.product_path("[PROJECT]", "[LOCATION]", "[PRODUCT]")

        client.delete_product(name)

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