本文整理汇总了Python中transaction.Transaction.associate_credit_card方法的典型用法代码示例。如果您正苦于以下问题:Python Transaction.associate_credit_card方法的具体用法?Python Transaction.associate_credit_card怎么用?Python Transaction.associate_credit_card使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类transaction.Transaction
的用法示例。
在下文中一共展示了Transaction.associate_credit_card方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestTransaction
# 需要导入模块: from transaction import Transaction [as 别名]
# 或者: from transaction.Transaction import associate_credit_card [as 别名]
class TestTransaction(unittest.TestCase):
def setUp(self):
Transaction.objects = {}
self.transaction = Transaction(datetime(2014, 10, 4, 20, 0), 33.50)
def test_initial_attributes(self):
self.transaction.date |should| equal_to(datetime(2014, 10, 4, 20, 0))
self.transaction.month |should| equal_to(10)
self.transaction.value |should| equal_to(33.50)
self.transaction.id |should| equal_to(1)
def test_persistence(self):
Transaction.objects |should| equal_to({ 1: self.transaction })
def test_associate_credit_card(self):
with Stub() as credit_card: credit_card.id >> 1
self.transaction.associate_credit_card(credit_card)
self.transaction.credit_card_id |should| equal_to(credit_card.id)
def test_associate_seller(self):
with Stub() as seller: seller.id >> 1
self.transaction.associate_seller(seller)
self.transaction.seller_id |should| equal_to(seller.id)