本文整理汇总了Python中stoqlib.domain.payment.method.PaymentMethod.create_payment方法的典型用法代码示例。如果您正苦于以下问题:Python PaymentMethod.create_payment方法的具体用法?Python PaymentMethod.create_payment怎么用?Python PaymentMethod.create_payment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类stoqlib.domain.payment.method.PaymentMethod
的用法示例。
在下文中一共展示了PaymentMethod.create_payment方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_create_payment
# 需要导入模块: from stoqlib.domain.payment.method import PaymentMethod [as 别名]
# 或者: from stoqlib.domain.payment.method.PaymentMethod import create_payment [as 别名]
def test_create_payment(self):
acc = self.create_account()
branch = self.create_branch()
method = PaymentMethod(method_name=u'Test', destination_account=acc)
group = self.create_payment_group()
self.create_payment(payment_type=Payment.TYPE_IN, date=None,
value=100, method=method, branch=branch,
group=group)
with self.assertRaisesRegex(
PaymentMethodError,
('You can not create more inpayments for this payment '
'group since the maximum allowed for this payment '
'method is 1')):
method.create_payment(payment_type=Payment.TYPE_IN, payment_group=group,
branch=branch, value=100, due_date=None,
description=None, base_value=None,
payment_number=None)
self.create_payment(payment_type=Payment.TYPE_IN, date=None,
value=100, method=method, branch=branch,
group=group)
with self.assertRaises(DatabaseInconsistency):
method.create_payment(payment_type=Payment.TYPE_IN, payment_group=group,
branch=branch, value=100, due_date=None,
description=None, base_value=None,
payment_number=None)
示例2: test_create_payment
# 需要导入模块: from stoqlib.domain.payment.method import PaymentMethod [as 别名]
# 或者: from stoqlib.domain.payment.method.PaymentMethod import create_payment [as 别名]
def test_create_payment(self):
acc = self.create_account()
branch = self.create_branch()
method = PaymentMethod(method_name=u'Test', destination_account=acc)
group = self.create_payment_group()
self.create_payment(payment_type=Payment.TYPE_IN, date=None,
value=100, method=method, branch=branch,
group=group)
with self.assertRaises(PaymentMethodError):
method.create_payment(payment_type=Payment.TYPE_IN, payment_group=group,
branch=branch, value=100, due_date=None,
description=None, base_value=None,
till=ValueUnset, payment_number=None)
self.create_payment(payment_type=Payment.TYPE_IN, date=None,
value=100, method=method, branch=branch,
group=group)
with self.assertRaises(DatabaseInconsistency):
method.create_payment(payment_type=Payment.TYPE_IN, payment_group=group,
branch=branch, value=100, due_date=None,
description=None, base_value=None,
till=ValueUnset, payment_number=None)
with self.assertRaises(AssertionError):
method.create_payment(payment_type=9, payment_group=group,
branch=branch, value=100, due_date=None,
description=None, base_value=None,
till=ValueUnset, payment_number=None)
示例3: test_create_payment
# 需要导入模块: from stoqlib.domain.payment.method import PaymentMethod [as 别名]
# 或者: from stoqlib.domain.payment.method.PaymentMethod import create_payment [as 别名]
def test_create_payment(self):
acc = self.create_account()
branch = self.create_branch()
method = PaymentMethod(method_name=u'Test', destination_account=acc)
group = self.create_payment_group()
self.create_payment(payment_type=Payment.TYPE_IN, date=None,
value=100, method=method, branch=branch,
group=group)
with self.assertRaisesRegexp(
PaymentMethodError,
('You can not create more inpayments for this payment '
'group since the maximum allowed for this payment '
'method is 1')):
method.create_payment(payment_type=Payment.TYPE_IN, payment_group=group,
branch=branch, value=100, due_date=None,
description=None, base_value=None,
till=ValueUnset, payment_number=None)
self.create_payment(payment_type=Payment.TYPE_IN, date=None,
value=100, method=method, branch=branch,
group=group)
with self.assertRaises(DatabaseInconsistency):
method.create_payment(payment_type=Payment.TYPE_IN, payment_group=group,
branch=branch, value=100, due_date=None,
description=None, base_value=None,
till=ValueUnset, payment_number=None)
with self.assertRaises(AssertionError):
method.create_payment(payment_type=9, payment_group=group,
branch=branch, value=100, due_date=None,
description=None, base_value=None,
till=ValueUnset, payment_number=None)
with mock.patch('stoqlib.domain.till.Till.get_current') as get_current:
get_current.side_effect = TillError('foobar')
with self.assertRaisesRegexp(PaymentMethodError, 'foobar'):
method.create_payment(payment_type=Payment.TYPE_IN,
payment_group=self.create_payment_group(),
branch=branch, value=100, due_date=None,
description=None, base_value=None,
till=ValueUnset)