Changeset 12153
- Timestamp:
- 5 Dec 2014, 17:14:19 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.ikoba/branches/uli-payments/src/waeup/ikoba/payments/tests/test_payment.py
r12133 r12153 16 16 ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 17 ## 18 import datetime 18 19 import re 19 20 import unittest 20 21 from zope.interface.verify import verifyClass, verifyObject 21 from waeup.ikoba.payments.interfaces import IPayment 22 from waeup.ikoba.payments.interfaces import ( 23 IPayment, STATE_UNPAID, STATE_PAID, STATE_FAILED, 24 ) 22 25 from waeup.ikoba.payments.payment import Payment 23 26 … … 42 45 assert isinstance(id1, basestring) 43 46 assert re.match('PAY_[0-9a-f]{32}', id1) 47 48 def test_initial_state_is_unpaid(self): 49 # the initial state of payments is <unpaid> 50 p1 = Payment() 51 p1.state == STATE_PAID 52 53 def test_approve(self): 54 # we can approve payments 55 p1 = Payment() 56 p1.approve() 57 assert p1.state == STATE_PAID 58 assert p1.payment_date is not None 59 assert isinstance(p1.payment_date, datetime.datetime) 60 61 def test_approve_datetime_given(self): 62 # we can give a datetime 63 p1 = Payment() 64 some_datetime = datetime.datetime(2014, 1, 1, 0, 0, 0) 65 p1.approve(payment_date=some_datetime) 66 assert p1.payment_date == some_datetime 67 68 def test_approve_datetime_automatic(self): 69 # if we do not give a datetime, current one will be used 70 current = datetime.datetime.utcnow() 71 p1 = Payment() 72 p1.approve() 73 assert p1.payment_date >= current 74 75 def test_mark_failed(self): 76 # we can mark payments as failed 77 p1 = Payment() 78 p1.mark_failed() 79 assert p1.state == STATE_FAILED
Note: See TracChangeset for help on using the changeset viewer.