CPS is an enormously powerful agency, and if they have reason to believe that a child is at risk because he's in an unsafe environment, the state allows them to swoop in and remove a child from the household. CPS is notorious for pushing their weight around, for stepping all over parents' rights, and even for fabricating facts and evidence to support their findings. Even worse, judges tend to believe CPS.
So it's not quite true that you had no rights. You could have, for example, refused to let CPS into your home until they showed up with a warrant. You could have refused to take any drug test, insisted on a lawyer. However, because of the power that the state allows them to have, in the end, when CPS wants to investigate you and your home and have you tested for drugs, what they want would come about one way or the other. That is, they would have obtained the warrant, taken your son, and then brought you to court where the judge would require drug testing.
If you want to go after CPS, you can do so, but your first priority should be getting yourself a lawyer to try to get your child returned to you.