From 8d91dd949180493e1efca1ed8520ee5a95523597 Mon Sep 17 00:00:00 2001 From: Holger Brunn Date: Thu, 12 Oct 2017 12:37:41 +0200 Subject: [PATCH] [ADD] more tests --- base_import_odoo/tests/test_base_import_odoo.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/base_import_odoo/tests/test_base_import_odoo.py b/base_import_odoo/tests/test_base_import_odoo.py index 8b3128306..744350fc1 100644 --- a/base_import_odoo/tests/test_base_import_odoo.py +++ b/base_import_odoo/tests/test_base_import_odoo.py @@ -3,6 +3,7 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from mock import patch from openerp.tests.common import TransactionCase, post_install, at_install +from ..models.import_odoo_database import ImportContext, field_context class TestBaseImportOdoo(TransactionCase): @@ -70,7 +71,6 @@ class TestBaseImportOdoo(TransactionCase): self.assertTrue(attachment) self.assertEqual(attachment.datas, imported_attachment.datas) self.assertNotEqual(attachment, imported_attachment) - # TODO: test much more run += 1 demodb = self.env.ref('base_import_odoo.demodb') for line in demodb.import_line_ids: @@ -81,6 +81,15 @@ class TestBaseImportOdoo(TransactionCase): demodb.action_import() self.assertTrue(demodb.cronjob_id.active) self.assertFalse(demodb.cronjob_running) + # in our setting we won't get dummies, so we test this manually + import_context = ImportContext( + None, None, [], {}, {}, [], {}, field_context(None, None, None) + ) + dummy_id = demodb._run_import_create_dummy( + import_context, self.env['res.partner'], {'id': 424242}, + forcecreate=True, + ) + self.assertTrue(self.env['res.partner'].browse(dummy_id).exists()) def _get_xmlid(self, remote_xmlid): remote_obj = self.env.ref(remote_xmlid)