from django.test import TestCase

from coupons.forms import CouponGenerationForm


class CouponGenerationFormTestCase(TestCase):
    def test_form(self):
        form_data = {'quantity': 23, 'value': 42, 'type': 'monetary'}
        form = CouponGenerationForm(data=form_data)
        self.assertTrue(form.is_valid())


@@ -73,17 +73,62 @@
 tionForm
-%0A
+, CouponForm%0Afrom coupons.models import Coupon
 %0A%0Aclass 
@@ -262,16 +262,16 @@
 etary'%7D%0A
-
         
@@ -356,8 +356,448 @@
 lid())%0A%0A
+class CouponFormTestCase(TestCase):%0A    def setUp(self):%0A        self.coupon = Coupon.objects.create_coupon('monetary', 100)%0A%0A    def test_wrong_code(self):%0A        form_data = %7B'code': 'foo'%7D%0A        form = CouponForm(data=form_data)%0A        self.assertFalse(form.is_valid())%0A%0A    def test_right_code(self):%0A        form_data = %7B'code': self.coupon.code%7D%0A        form = CouponForm(data=form_data)%0A        self.assertTrue(form.is_valid())%0A%0A

add basic CouponFormTestCase