'Test to check for the top coupon codes used.'

def test_get_top_discount_codes_used(self):

    self.login_user(self.user.username)
    self.add_coupon(self.course_key, True, 'Ad123asd')
    self.add_coupon(self.course_key, True, '32213asd')
    self.purchases_using_coupon_codes()
    top_discounted_codes = CouponRedemption.get_top_discount_codes_used(self.course_key)
    self.assertTrue(top_discounted_codes[0]['coupon__code'], 'Ad123asd')
    self.assertTrue(top_discounted_codes[0]['coupon__used_count'], 1)
    self.assertTrue(top_discounted_codes[1]['coupon__code'], '32213asd')
    self.assertTrue(top_discounted_codes[1]['coupon__used_count'], 2)
