Ignore:
Timestamp:
20 Mar 2015, 13:07:29 (10 years ago)
Author:
uli
Message:

Remove item_id from PaymentItem?.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.ikoba/trunk/src/waeup/ikoba/payments/tests/test_payment.py

    r12790 r12800  
    2121import re
    2222import unittest
     23from decimal import Decimal
    2324from zope.component import (
    2425    getUtilitiesFor, getSiteManager, queryUtility, getGlobalSiteManager,
     
    5253
    5354FAKE_PAYMENT_ITEMS = (
    54     PaymentItem(u'ITEM1', u'Item title 1', decimal.Decimal("1.00")),
    55     PaymentItem(u'ITEM2', u'Item title 2', decimal.Decimal("2.2")),
     55    PaymentItem(u'Item title 1', decimal.Decimal("1.00")),
     56    PaymentItem(u'Item title 2', decimal.Decimal("2.2")),
    5657    )
    5758
     
    375376        obj = PaymentItem()
    376377        self.assertEqual(
    377             obj.to_string(), u"(u'0', u'', u'0.00')")
     378            obj.to_string(), u"(u'', u'0.00')")
    378379
    379380    def test_to_string_none_values(self):
     
    382383        obj.item_id = None
    383384        self.assertEqual(
    384             obj.to_string(), u"(None, u'', u'0.00')")
     385            obj.to_string(), u"(u'', u'0.00')")
    385386
    386387    def test_to_string_enocded_values(self):
     
    389390        obj.title = u'ümläut'
    390391        self.assertEqual(
    391             obj.to_string(), u"(u'0', u'ümläut', u'0.00')")
     392            obj.to_string(), u"(u'ümläut', u'0.00')")
    392393
    393394    def test_repr(self):
     
    396397        self.assertEqual(
    397398            repr(obj),
    398             "PaymentItem(item_id=u'0', title=u'', amount=Decimal('0.00'))")
     399            "PaymentItem(title=u'', amount=Decimal('0.00'))")
    399400
    400401    def test_repr_can_be_evaled(self):
    401402        # we can eval() representations
    402         obj = PaymentItem(
    403             item_id=u'12', title=u'My Title', amount=decimal.Decimal("1.99"))
     403        obj = PaymentItem(title=u'My Title', amount=decimal.Decimal("1.99"))
    404404        representation = repr(obj)
    405405        self.assertEqual(
    406406            representation,
    407             ("PaymentItem(item_id=u'12', title=u'My Title', "
    408              "amount=Decimal('1.99'))")
     407            "PaymentItem(title=u'My Title', amount=Decimal('1.99'))"
    409408            )
    410         from decimal import Decimal
    411409        new_obj = eval(representation)
    412410        assert new_obj is not obj
    413         assert new_obj.item_id == obj.item_id == u"12"
    414411        assert new_obj.title == obj.title == u"My Title"
    415412        assert new_obj.amount == obj.amount == Decimal("1.99")
Note: See TracChangeset for help on using the changeset viewer.