From d1bfc5509ee4244c115e5bfe88ed5e2eb38bd769 Mon Sep 17 00:00:00 2001 From: Laetitia Gangloff Date: Wed, 23 Jul 2014 09:41:54 +0200 Subject: [PATCH] add little test for datetime support --- mis_builder/tests/__init__.py | 33 ++++++++++++++++++++ mis_builder/tests/mis_builder_test.py | 44 +++++++++++++++++++++++++++ 2 files changed, 77 insertions(+) create mode 100644 mis_builder/tests/__init__.py create mode 100644 mis_builder/tests/mis_builder_test.py diff --git a/mis_builder/tests/__init__.py b/mis_builder/tests/__init__.py new file mode 100644 index 00000000..6b6fc305 --- /dev/null +++ b/mis_builder/tests/__init__.py @@ -0,0 +1,33 @@ +#============================================================================== +# = +# mis_builder module for OpenERP, Management Information System Builder +# Copyright (C) 2014 ACSONE SA/NV () +# = +# This file is a part of mis_builder +# = +# mis_builder is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License v3 or later +# as published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# = +# mis_builder is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License v3 or later for more details. +# = +# You should have received a copy of the GNU Affero General Public License +# v3 or later along with this program. +# If not, see . +# = +#============================================================================== + +import mis_builder_test + +fast_suite = [ +] + +checks = [ + mis_builder_test, +] + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/mis_builder/tests/mis_builder_test.py b/mis_builder/tests/mis_builder_test.py new file mode 100644 index 00000000..8b12842b --- /dev/null +++ b/mis_builder/tests/mis_builder_test.py @@ -0,0 +1,44 @@ +#============================================================================== +# = +# mis_builder module for OpenERP, Management Information System Builder +# Copyright (C) 2014 ACSONE SA/NV () +# = +# This file is a part of mis_builder +# = +# mis_builder is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License v3 or later +# as published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# = +# mis_builder is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License v3 or later for more details. +# = +# You should have received a copy of the GNU Affero General Public License +# v3 or later along with this program. +# If not, see . +# = +#============================================================================== + +import openerp.tests.common as common +from openerp.addons.mis_builder import models + + +DB = common.DB +ADMIN_USER_ID = common.ADMIN_USER_ID + + +class mis_builder_test(common.TransactionCase): + + def setUp(self): + super(mis_builder_test, self).setUp() + + def test_datetime_conversion(self): + date_to_convert = '2014-07-05' + date_time_convert = models.mis_builder.utc_midnight(date_to_convert) + self.assertEqual(date_time_convert, '2014-07-05 00:00:00', 'The converted date time convert must contains hour') + date_time_convert = models.mis_builder.utc_midnight(date_to_convert, add_day=1) + self.assertEqual(date_time_convert, '2014-07-06 00:00:00', 'The converted date time convert must contains hour') + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: