You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
1.2 KiB

  1. # -*- coding: utf-8 -*-
  2. from openerp.tests.common import TransactionCase
  3. from openerp.modules.module import get_module_resource
  4. class TestQifFile(TransactionCase):
  5. """Tests for import bank statement qif file format
  6. (account.bank.statement.import)
  7. """
  8. def setUp(self):
  9. super(TestQifFile, self).setUp()
  10. self.statement_import_model = self.env['account.bank.statement.import']
  11. self.statement_line_model = self.env['account.bank.statement.line']
  12. def test_qif_file_import(self):
  13. from openerp.tools import float_compare
  14. qif_file_path = get_module_resource(
  15. 'account_bank_statement_import_qif',
  16. 'test_qif_file', 'test_qif.qif')
  17. qif_file = open(qif_file_path, 'rb').read().encode('base64')
  18. bank_statement_improt = self.statement_import_model.with_context(
  19. journal_id=self.ref('account.bank_journal')).create(
  20. dict(data_file=qif_file))
  21. bank_statement_improt.import_file()
  22. bank_statement = self.statement_line_model.search(
  23. [('name', '=', 'YOUR LOCAL SUPERMARKET')], limit=1)[0].statement_id
  24. assert float_compare(bank_statement.balance_end_real, -1896.09, 2) == 0