From a9b3b309f1b30c6b71b80bc7fccde701b495f936 Mon Sep 17 00:00:00 2001 From: Andrea Date: Thu, 17 Jan 2019 09:51:27 +0100 Subject: [PATCH] Better tests --- .../tests/test_account_invoice_spread.py | 9 ++++----- .../tests/test_compute_spread_board.py | 5 ++--- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/account_spread_cost_revenue/tests/test_account_invoice_spread.py b/account_spread_cost_revenue/tests/test_account_invoice_spread.py index 01e0d559..9f2d46c9 100644 --- a/account_spread_cost_revenue/tests/test_account_invoice_spread.py +++ b/account_spread_cost_revenue/tests/test_account_invoice_spread.py @@ -46,10 +46,10 @@ class TestAccountInvoiceSpread(common.TransactionCase): 'reconcile': True }) - partner = self.env['res.partner'].create([{ + partner = self.env['res.partner'].create({ 'name': 'Partner Name', 'supplier': True, - }]) + }) self.invoice = self.env['account.invoice'].create({ 'partner_id': partner.id, 'account_id': self.invoice_account.id, @@ -725,9 +725,8 @@ class TestAccountInvoiceSpread(common.TransactionCase): self.assertFalse(spread_ml.matched_credit_ids) self.assertFalse(spread_ml.full_reconcile_id) - other_journal = self.env['account.journal'].search([ - ('id', '!=', self.invoice_2.journal_id.id), - ], limit=1) + other_journal = self.env['account.journal'].create({ + 'name': 'Other Journal', 'type': 'general', 'code': 'test2'}) self.assertTrue(other_journal) with self.assertRaises(ValidationError): self.spread2.journal_id = other_journal diff --git a/account_spread_cost_revenue/tests/test_compute_spread_board.py b/account_spread_cost_revenue/tests/test_compute_spread_board.py index c16cdfdd..f9dec983 100644 --- a/account_spread_cost_revenue/tests/test_compute_spread_board.py +++ b/account_spread_cost_revenue/tests/test_compute_spread_board.py @@ -14,9 +14,8 @@ class TestComputeSpreadBoard(common.TransactionCase): type_receivable = self.env.ref('account.data_account_type_receivable') type_expenses = self.env.ref('account.data_account_type_expenses') - journal = self.env['account.journal'].search([ - ('type', '=', 'general')], - limit=1) + journal = self.env['account.journal'].create({ + 'name': 'Test', 'type': 'general', 'code': 'test'}) self.receivable_account = self.env['account.account'].create({ 'name': 'test_account_receivable',