Medical marijuana?

Hey so I'm just wondering.. If weed shows up in a drug test, what happens when you're tested and you've had medical marijuana? 
 
Isn't it the same thing? What would the outcome be?