Frankly, you went in without an attorney and did not provide the appropriate information to the court. The court will only order drug tests (urine) based on competent and admissible evidence. Next time use a capable and experienced family law attorney.
This answer is not intended to give you any legal advice as the information provided by you is insufficient to provide any legal advice. You must seek the services of a qualified and experienced attorney before acting on any advice from this website or any other place.