A large reason they can get away with it is becuase of a couple things. First the initial drug test prior to employment does not check T levels. Only rec. drugs. Its a urine test, where T is tested by blood.
Second once on the force, at most department, they have very lengthy and strict union contracts that usually have attornys that write these up. This is to protect the cops from lots of things, pay, uniforms, days off, discipline, and drug testing. Now these contracts are paid by union dues or association dues by the officers to have this protection.
To be drug tested, you generally have to have had a shooting, accident (vehicle), or smell of alcohol or really appear to be under the influence. So only at those times with most union contacts for cops, can they be tested. However, once again, these are 5 panel drug screens. Opiates, coke, amphetamines, alcohol, barbituates/benzo. They don't test for T.
Also, because T, dbol, tren, etc does not cause "impairment" as with narcotics or alcohol, they usually don't care too much. In fact I recently read about an officer that got caught with and using primobolan amps. Among other things (can't remember if it was T, Deca, or what else he was using, but had a ton of Primobolan amps) He was suspended for two weeks, without pay, drugs confiscated to evidence. And he was not "charged" criminally, just via the department. This was all due to the strong union contract for the officers.
I have been a union steward for years. And meet with others from different areas of employment including officers. I can tell you I have seen some of there contracts, and they are tight locked in the officers favor.
Not saying its cool they get away with it and we can be charged, however, where I live, unless you are selling the don't do much. They confinscate at a minimum and may write a summons to appear in court where you may have to pay a fine, do comm service. If you get caught dealing, different story.
Anyway, thats what I know about from working in the union for so long and meeting some of the stewards for the officers and talking with them...