From bc94bd837ca78271a7ad4b6ed2982e3b3751da94 Mon Sep 17 00:00:00 2001 From: Stefan Rijnhart Date: Fri, 9 Dec 2016 17:29:09 +0100 Subject: [PATCH] Create demo data during the execution of tests This ensures that the demo chart of accounts is already installed when the bank journal account is created for the bank journal that is needed to test the import. Otherwise, the demo chart from l10n_generic_coa will fail to install because there is already a journal account in the system. --- .../__manifest__.py | 3 --- .../demo/demo_data.xml | 15 --------------- .../tests/test_import_bank_statement.py | 15 +++++++++++++++ 3 files changed, 15 insertions(+), 18 deletions(-) delete mode 100644 account_bank_statement_import_camt/demo/demo_data.xml diff --git a/account_bank_statement_import_camt/__manifest__.py b/account_bank_statement_import_camt/__manifest__.py index 92e10bd1..2b1a3f56 100644 --- a/account_bank_statement_import_camt/__manifest__.py +++ b/account_bank_statement_import_camt/__manifest__.py @@ -11,9 +11,6 @@ 'depends': [ 'account_bank_statement_import', ], - 'demo': [ - 'demo/demo_data.xml', - ], 'data': [ 'views/account_bank_statement_import.xml', ], diff --git a/account_bank_statement_import_camt/demo/demo_data.xml b/account_bank_statement_import_camt/demo/demo_data.xml deleted file mode 100644 index e6313a13..00000000 --- a/account_bank_statement_import_camt/demo/demo_data.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - NL77ABNA0574908765 - - - - - - Bank Journal - (test camt) - TBNKCAMT - bank - - - diff --git a/account_bank_statement_import_camt/tests/test_import_bank_statement.py b/account_bank_statement_import_camt/tests/test_import_bank_statement.py index 496ae943..b043e712 100644 --- a/account_bank_statement_import_camt/tests/test_import_bank_statement.py +++ b/account_bank_statement_import_camt/tests/test_import_bank_statement.py @@ -18,6 +18,21 @@ class TestImport(TransactionCase): }, ] + def setUp(self): + super(TestImport, self).setUp() + bank = self.env['res.partner.bank'].create({ + 'acc_number': 'NL77ABNA0574908765', + 'partner_id': self.env.ref('base.main_partner').id, + 'company_id': self.env.ref('base.main_company').id, + 'bank_id': self.env.ref('base.res_bank_1').id, + }) + self.env['account.journal'].create({ + 'name': 'Bank Journal - (test camt)', + 'code': 'TBNKCAMT', + 'type': 'bank', + 'bank_account_id': bank.id, + }) + def test_statement_import(self): """Test correct creation of single statement.""" action = {}