The urine test for cocaine is used to detect the presence of cocaine or its metabolites This test is often done to detect the use of marijuana. It may be required for employment drug screenings, by legal authorities, or for medical purposes to monitor the use of cannabinoids.