Browse Source

IMP acc_export_csv: test the number of lines of the file

pull/704/head
David Beal 4 years ago
parent
commit
4a04127c7c
  1. 12
      account_export_csv/tests/test_account_export_csv.py

12
account_export_csv/tests/test_account_export_csv.py

@ -3,6 +3,7 @@
from datetime import date from datetime import date
from dateutil import relativedelta from dateutil import relativedelta
import base64
from odoo.tests.common import TransactionCase from odoo.tests.common import TransactionCase
from odoo import fields from odoo import fields
@ -38,3 +39,14 @@ class TestAccountExportCsv(TransactionCase):
'date_end': self.report_date_end 'date_end': self.report_date_end
}) })
report_wizard.action_manual_export_journal_entries() report_wizard.action_manual_export_journal_entries()
def test_file_content(self):
report_wizard = self.report_wizard.create({
"date_start": "2000-01-01",
"date_end": "2200-01-01",
})
report_wizard.action_manual_export_journal_entries()
res = base64.decodestring(report_wizard.data)
line_number = self.env["account.move.line"].search_count([])
# check the number of lines in file: include header + EOF line
self.assertEqual(len(res.decode().split("\r\n")), line_number + 2)
Loading…
Cancel
Save