Esempio n. 1
0
 def test_addRecord(self):
     addSampleRecords(self.expense)
     
     recbuf = Config.getRecordBuffer()
     self.assertEqual(
         len(recbuf), 21
     )
     self.expense.setUp({'test':True})
     
     recbuf = Config.getRecordBuffer()
     self.assertEqual(
         len(recbuf), 0
     )
Esempio n. 2
0
    def test_getBufferObj_and_setBufferObj(self):
        projbuf = {
            'python': 6,
            'tcl': 3,
            'ruby': 4,
            'lua': 3,
            'perl': 4,
        }
        Config.setProjectBuffer(projbuf)
        bufobj = Config.getProjectBuffer()
        self.assertDictEqual(bufobj, projbuf)
        Config.setProjectBuffer({})

        rec = BaseRecord(1, (u'Food & Drinks', u'Snacks'), u'Cash', u'CHY')
        recbuf = [
            [
                '2012-01-03',
                rec.amount,
                rec.type[0],
                rec.type[1],
                rec.payment,
                rec.currency,
                rec.tag,
                rec.comment
            ]
        ]
        Config.setRecordBuffer(recbuf)
        bufobj = Config.getRecordBuffer()
        self.assertListEqual(bufobj, recbuf)
        Config.setRecordBuffer([])