From 4a04127c7c67be3c2a764913a17325386fda7602 Mon Sep 17 00:00:00 2001 From: David Beal Date: Thu, 25 Jun 2020 16:57:01 +0200 Subject: [PATCH] IMP acc_export_csv: test the number of lines of the file --- account_export_csv/tests/test_account_export_csv.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/account_export_csv/tests/test_account_export_csv.py b/account_export_csv/tests/test_account_export_csv.py index 92ed402b..e7e90220 100644 --- a/account_export_csv/tests/test_account_export_csv.py +++ b/account_export_csv/tests/test_account_export_csv.py @@ -3,6 +3,7 @@ from datetime import date from dateutil import relativedelta +import base64 from odoo.tests.common import TransactionCase from odoo import fields @@ -38,3 +39,14 @@ class TestAccountExportCsv(TransactionCase): 'date_end': self.report_date_end }) 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)