The funeral ceremony of Ali Khamenei, Iran's former leader, presented the Iranian government with its first major political test following his death, offering an opportunity to shape the narrative of his passing for both domestic and international audiences.