Parashas Vezos Haberachah
And of Levi he said: Your Thummim and Your Urim be with Your faithful one, whom You tested at Massah, with whom You contended at the waters of Merivah.
Sifrei / midrashim on the testing of Levi
English: “Your Thummim and Your Urim be with Your faithful one” — these are the Urim and Thummim given to the Kohen. “Whom You tested at Massah” — at Massah and Merivah the tribe was tested and no fault was found in it. “With whom You contended at the waters of Merivah” — even at the time of the contention he stood in his righteousness.
Custom (historical testing as the ground for priestly privilege).
See the Core Text and context note for the specific point derived from the verse.