I know from using email template codes the discount code field can be multiple discount code(s) for an order, see this document for the brief explanation:
http://docs.shopify.com/manual/settings/notifications/email-variables#discounts
Have you tried using: {% if discount.first.code == 'testcoupon123' %}