Пример #1
0
    def test_dateIsDateObjectWhenRetrieved(self):
        db = Db(path=self.f.name + '/tmp')
        accountOne = Account(name='one')
        db.recordAccount(accountOne)
        t1 = Transaction(name="a", date=dtd.today(), amount=123)
        t1.account = accountOne
        db.recordTransactions([t1])

        transactions = db.transactions('a')
        self.assertTrue(isinstance(transactions[0].date, dtd))
Пример #2
0
    def test_listTransactions(self):
        db = Db(path=self.f.name + '/tmp')
        accountOne = Account(name='one')
        accountTwo = Account(name='two')
        db.recordAccount(accountOne)
        db.recordAccount(accountTwo)
        t1 = Transaction(name="a", date=dtd.today(), amount=123)
        t1.account = accountOne
        t2 = Transaction(name="b", date=dtd.today(), amount=2000)
        t2.account = accountTwo
        t3 = Transaction(name="ab", date=dtd.today(), amount=3.00)
        t3.account = accountTwo
        db.recordTransactions([t1, t2, t3])

        transactions = db.transactions('a')
        self.assertEqual({'a', 'ab'}, {t.name for t in transactions})