I have been, and it was legally and officially OK.
I am a Straight, White, Male who has a decent education, and a reasonable level of competence, meaning I passed the test on first try.
I was passed over in favor of a semi-literate black man who could not pass the test even with bonus points for being ethnic (who ended up arrested on several drug charges a year or so later), and a gay white woman (who was later fired for poor attendance while on the probationary period in the supervisors job) because of "Affirmative Action".
If I had been in the mood, and given to such pursuits, it would have made one hell of a lawsuit.
As it is, I decided instead to laugh my ass off at the 'bosses' who were falling all over themselves trying to tell a reasonable lie to explain what happened.