From caf2725f8cc0cbe19650beba41416b96e1b11035 Mon Sep 17 00:00:00 2001 From: Andrea Date: Thu, 26 Jul 2018 11:56:00 +0200 Subject: [PATCH] Add basic tests --- .../tests/__init__.py | 3 ++ .../test_l10n_nl_xaf_auditfile_export.py | 51 +++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 l10n_nl_xaf_auditfile_export/tests/__init__.py create mode 100644 l10n_nl_xaf_auditfile_export/tests/test_l10n_nl_xaf_auditfile_export.py diff --git a/l10n_nl_xaf_auditfile_export/tests/__init__.py b/l10n_nl_xaf_auditfile_export/tests/__init__.py new file mode 100644 index 000000000..8c1ca88d5 --- /dev/null +++ b/l10n_nl_xaf_auditfile_export/tests/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import test_l10n_nl_xaf_auditfile_export diff --git a/l10n_nl_xaf_auditfile_export/tests/test_l10n_nl_xaf_auditfile_export.py b/l10n_nl_xaf_auditfile_export/tests/test_l10n_nl_xaf_auditfile_export.py new file mode 100644 index 000000000..d39e3a7c9 --- /dev/null +++ b/l10n_nl_xaf_auditfile_export/tests/test_l10n_nl_xaf_auditfile_export.py @@ -0,0 +1,51 @@ +# Copyright 2018 Onestein () +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo.tests.common import TransactionCase + + +class TestXafAuditfileExport(TransactionCase): + + def test_01_default_values(self): + ''' Check that the default values are filled on creation ''' + record = self.env['xaf.auditfile.export'].create({}) + + self.assertTrue(record) + self.assertTrue(record.name) + self.assertFalse(record.auditfile) + self.assertTrue(record.auditfile_name) + self.assertTrue(record.company_id) + self.assertTrue(record.date_start) + self.assertTrue(record.date_end) + self.assertFalse(record.date_generated) + self.assertTrue(record.fiscalyear_name) + + def test_02_export_success(self): + ''' Do a basic auditfile export ''' + record = self.env['xaf.auditfile.export'].create({}) + record.button_generate() + + self.assertTrue(record.name) + self.assertTrue(record.auditfile) + self.assertTrue(record.auditfile_name) + self.assertTrue(record.company_id) + self.assertTrue(record.date_start) + self.assertTrue(record.date_end) + self.assertTrue(record.date_generated) + self.assertTrue(record.fiscalyear_name) + + def test_03_export_error(self): + ''' Failure to export an auditfile ''' + record = self.env['xaf.auditfile.export'].create({}) + record.company_id.country_id = False + record.button_generate() + + self.assertTrue(record) + self.assertTrue(record.name) + self.assertFalse(record.auditfile) + self.assertTrue(record.auditfile_name) + self.assertTrue(record.company_id) + self.assertTrue(record.date_start) + self.assertTrue(record.date_end) + self.assertTrue(record.date_generated) + self.assertTrue(record.fiscalyear_name)