コード例 #1
0
 def test_deposit(self):
     personal = Account.objects.create(name='foo')
     other = Account.objects.create(name='bar', account_type=Account.AccountType.FOREIGN)
     form = RecurringTransactionForm({
         'amount': 100, 'date': '2100-01-01', 'multiplier': 1,
         'src': other.id, 'dst': personal.id, 'interval': RecurringTransaction.MONTHLY,
         'title': 'foo', 'weekend_handling': RecurringTransaction.SKIP, 'usual_month_day': 0})
     self.assertTrue(form.is_valid())
     transaction = form.save()
     self.assertIsNotNone(transaction)
     self.assertEqual(transaction.transaction_type, Transaction.DEPOSIT)
コード例 #2
0
 def test_transfer(self):
     personal = Account.objects.create(name='foo')
     other = Account.objects.create(name='bar')
     form = RecurringTransactionForm({
         'amount': 100,
         'date': '2100-01-01',
         'src': personal.id,
         'dst': other.id,
         'recurrence': RecurringTransaction.MONTHLY,
         'title': 'foo'
     })
     self.assertTrue(form.is_valid())
     transaction = form.save()
     self.assertEqual(transaction.transaction_type, Transaction.TRANSFER)
     self.assertIsNotNone(transaction)
コード例 #3
0
 def test_transfer_with_existing_accounts(self):
     personal = Account.objects.create(name='foo')
     other = Account.objects.create(name='bar')
     form = RecurringTransactionForm({
         'amount': 100,
         'transaction_type': Transaction.TRANSFER,
         'date': '2100-01-01',
         'src': personal,
         'dst': other,
         'recurrence': RecurringTransaction.MONTHLY,
         'title': 'foo'
     })
     self.assertTrue(form.is_valid())
     transaction = form.save()
     self.assertIsNotNone(transaction)
     self.assertEquals(transaction.src, personal)
     self.assertEquals(transaction.dst, other)