コード例 #1
0
 def test_import_santander(self):
     ofx = OFXImporter()
     ofx.feed(StringIO(OFX_DATA3))
     ofx.set_dry(True)
     ofx.process(self.store)
     account = self.store.find(Account).order_by(Account.code).first()
     self.failUnless(account)
     self.assertEquals(account.description, u"SANTANDER - CHECKING")
     self.assertEquals(account.code, u"012345678")
     self.assertEquals(account.transactions.count(), 1)
     self.assertEquals(account.account_type, Account.TYPE_BANK)
     t = account.transactions[0]
     self.assertEquals(t.value, Decimal("-123.67"))
     self.assertEquals(t.code, u'00801000')
     self.assertEquals(t.description, u'PGTO TITULO OUTRO')
コード例 #2
0
 def test_import_bb_fisica(self):
     ofx = OFXImporter()
     ofx.feed(StringIO(OFX_DATA2))
     ofx.set_dry(True)
     ofx.process(self.store)
     account = self.store.find(Account).order_by(Account.code).first()
     self.failUnless(account)
     self.assertEquals(account.description, "Banco do Brasil - CHECKING")
     self.assertEquals(account.code, "67890-X")
     self.assertEquals(account.transactions.count(), 1)
     self.assertEquals(account.account_type, Account.TYPE_BANK)
     t = account.transactions[0]
     self.assertEquals(t.value, Decimal("-35.65"))
     self.assertEquals(t.code, '000000104485')
     self.assertEquals(t.description,
                       'Compra com Cartão - 01/01 01:23 BURRITOS')
コード例 #3
0
 def test_import_bb_juridica(self):
     ofx = OFXImporter()
     ofx.feed(StringIO(OFX_DATA))
     ofx.set_dry(True)
     ofx.process(self.store)
     account = self.store.find(Account).order_by(Account.code).first()
     self.failUnless(account)
     self.assertEquals(account.description, "Bank - CHECKING")
     self.assertEquals(account.code, "1234")
     self.assertEquals(account.transactions.count(), 2)
     self.assertEquals(account.account_type, Account.TYPE_BANK)
     t1, t2 = sorted(account.transactions, key=operator.attrgetter('value'))
     self.assertEquals(t1.value, -5)
     self.assertEquals(t1.code, '90068259')
     self.assertEquals(t2.value, 50)
     self.assertEquals(t2.code, '90068258')
コード例 #4
0
 def testOFXImportSantander(self):
     ofx = OFXImporter()
     ofx.feed(StringIO(OFX_DATA3))
     ofx.set_dry(True)
     ofx.process(self.store)
     account = self.store.find(Account).order_by(Account.id).last()
     self.failUnless(account)
     self.assertEquals(account.description, u"SANTANDER - CHECKING")
     self.assertEquals(account.code, u"012345678")
     self.assertEquals(account.transactions.count(), 1)
     self.assertEquals(account.account_type, Account.TYPE_BANK)
     t = account.transactions[0]
     self.assertEquals(t.value, Decimal("-123.67"))
     self.assertEquals(t.code, u'00801000')
     self.assertEquals(t.description,
                       u'PGTO TITULO OUTRO')
コード例 #5
0
 def testOFXImportBBFisica(self):
     ofx = OFXImporter()
     ofx.feed(StringIO(OFX_DATA2))
     ofx.set_dry(True)
     ofx.process(self.store)
     account = self.store.find(Account).order_by(Account.id).last()
     self.failUnless(account)
     self.assertEquals(account.description, "Banco do Brasil - CHECKING")
     self.assertEquals(account.code, "67890-X")
     self.assertEquals(account.transactions.count(), 1)
     self.assertEquals(account.account_type, Account.TYPE_BANK)
     t = account.transactions[0]
     self.assertEquals(t.value, Decimal("-35.65"))
     self.assertEquals(t.code, '000000104485')
     self.assertEquals(t.description,
                       'Compra com Cartão - 01/01 01:23 BURRITOS')
コード例 #6
0
 def testOFXImportBBJurdica(self):
     ofx = OFXImporter()
     ofx.feed(StringIO(OFX_DATA))
     ofx.set_dry(True)
     ofx.process(self.store)
     account = self.store.find(Account).order_by(Account.id).last()
     self.failUnless(account)
     self.assertEquals(account.description, "Bank - CHECKING")
     self.assertEquals(account.code, "1234")
     self.assertEquals(account.transactions.count(), 2)
     self.assertEquals(account.account_type, Account.TYPE_BANK)
     t1, t2 = sorted(account.transactions, key=operator.attrgetter('value'))
     self.assertEquals(t1.value, -5)
     self.assertEquals(t1.code, '90068259')
     self.assertEquals(t2.value, 50)
     self.assertEquals(t2.code, '90068258')
コード例 #7
0
ファイル: test_ofximporter.py プロジェクト: 5l1v3r1/stoq-1
    def test_import_existing_transaction(self):
        imbalance_account = self.create_account()
        other_account = self.create_account()
        with self.sysparam(IMBALANCE_ACCOUNT=imbalance_account):
            t1 = self.create_account_transaction(incoming=False,
                                                 code=u'90068259',
                                                 value=Decimal('5'),
                                                 account=other_account,
                                                 source=imbalance_account)
            t2 = self.create_account_transaction(incoming=True,
                                                 code=u'90068258',
                                                 value=Decimal('50'),
                                                 account=imbalance_account,
                                                 source=other_account)

            ofx = OFXImporter()
            ofx.feed(StringIO(OFX_DATA))
            ofx.set_dry(True)
            ofx.process(self.store)
            account = self.store.find(Account).order_by(Account.code).first()
            self.assertEqual(account.description, "Bank - CHECKING")
            self.assertEqual(account.code, "1234")
            self.assertEqual(account.transactions.count(), 2)
            self.assertEqual(account.account_type, Account.TYPE_BANK)
            t1, t2 = sorted(account.transactions,
                            key=operator.attrgetter('value'))
            self.assertEqual(t1.value, 5)
            self.assertEqual(t1.operation_type, AccountTransaction.TYPE_OUT)
            self.assertEqual(t1.code, '90068259')
            self.assertEqual(t1.description, 'Banco taxa 10%')
            self.assertEqual(t1.source_account, account)
            self.assertEqual(t2.value, 50)
            self.assertEqual(t2.operation_type, AccountTransaction.TYPE_IN)
            self.assertEqual(t2.code, '90068258')
            self.assertEqual(t2.description, 'A Transaction')
            self.assertEqual(t2.account, account)
コード例 #8
0
ファイル: test_ofximporter.py プロジェクト: Guillon88/stoq
    def test_import_existing_transaction(self):
        imbalance_account = self.create_account()
        other_account = self.create_account()
        with self.sysparam(IMBALANCE_ACCOUNT=imbalance_account):
            t1 = self.create_account_transaction(
                incoming=False,
                code=u'90068259',
                value=Decimal('5'),
                account=other_account,
                source=imbalance_account)
            t2 = self.create_account_transaction(
                incoming=True,
                code=u'90068258',
                value=Decimal('50'),
                account=imbalance_account,
                source=other_account)

            ofx = OFXImporter()
            ofx.feed(StringIO(OFX_DATA))
            ofx.set_dry(True)
            ofx.process(self.store)
            account = self.store.find(Account).order_by(Account.code).first()
            self.assertEquals(account.description, "Bank - CHECKING")
            self.assertEquals(account.code, "1234")
            self.assertEquals(account.transactions.count(), 2)
            self.assertEquals(account.account_type, Account.TYPE_BANK)
            t1, t2 = sorted(account.transactions, key=operator.attrgetter('value'))
            self.assertEquals(t1.value, 5)
            self.assertEquals(t1.operation_type, AccountTransaction.TYPE_OUT)
            self.assertEquals(t1.code, '90068259')
            self.assertEquals(t1.description, 'Banco taxa 10%')
            self.assertEquals(t1.source_account, account)
            self.assertEquals(t2.value, 50)
            self.assertEquals(t2.operation_type, AccountTransaction.TYPE_IN)
            self.assertEquals(t2.code, '90068258')
            self.assertEquals(t2.description, 'A Transaction')
            self.assertEquals(t2.account, account)