Commits

Kai Diefenbach committed 6d0b26d

Bugfix: fixed CreditCard's __unicode__ method; issue #172

Comments (0)

Files changed (2)

lfs/customer/models.py

     expiration_date_year = models.IntegerField(_(u"Expiration date year"), )
 
     def __unicode__(self):
-        return "%s / %s" % (self.card_type, self.card_owner)
+        return "%s / %s" % (self.type, self.owner)

lfs/customer/tests.py

 from django.core import mail
 
 # lfs imports
-from lfs.core.models import Shop, Country
-from lfs.customer.models import Customer, Address
+from lfs.core.models import Country
+from lfs.core.models import Shop
+from lfs.customer.models import Address
+from lfs.customer.models import CreditCard
+from lfs.customer.models import Customer
 from lfs.shipping.models import ShippingMethod
 from lfs.tax.models import Tax
 from lfs.payment.models import PaymentMethod
 
 
+class CreditCardTestCase(TestCase):
+    def setUp(self):
+        self.cc = CreditCard(
+            type = "mastercard",
+            owner = "John Doe",
+            number = "4711",
+            expiration_date_month = 8,
+            expiration_date_year = 2012
+        )
+
+    def test_unicode(self):
+        self.assertEquals(self.cc.__unicode__(), "%s / %s" % (self.cc.type, self.cc.owner))
+
+
 class AddressTestCase(TestCase):
 
     fixtures = ['lfs_shop.xml']