|
@ -22,10 +22,12 @@ |
|
|
# |
|
|
# |
|
|
############################################################################## |
|
|
############################################################################## |
|
|
|
|
|
|
|
|
import openerp.tests.common as common |
|
|
|
|
|
from openerp.addons.mis_builder import models |
|
|
|
|
|
from collections import OrderedDict |
|
|
from collections import OrderedDict |
|
|
|
|
|
|
|
|
|
|
|
import openerp.tests.common as common |
|
|
|
|
|
|
|
|
|
|
|
from ..models import mis_builder |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DB = common.DB |
|
|
DB = common.DB |
|
|
ADMIN_USER_ID = common.ADMIN_USER_ID |
|
|
ADMIN_USER_ID = common.ADMIN_USER_ID |
|
@ -38,19 +40,19 @@ class mis_builder_test(common.TransactionCase): |
|
|
|
|
|
|
|
|
def test_datetime_conversion(self): |
|
|
def test_datetime_conversion(self): |
|
|
date_to_convert = '2014-07-05' |
|
|
date_to_convert = '2014-07-05' |
|
|
date_time_convert = models.mis_builder._utc_midnight( |
|
|
|
|
|
|
|
|
date_time_convert = mis_builder._utc_midnight( |
|
|
date_to_convert, 'Europe/Brussels') |
|
|
date_to_convert, 'Europe/Brussels') |
|
|
self.assertEqual(date_time_convert, '2014-07-04 22:00:00', |
|
|
self.assertEqual(date_time_convert, '2014-07-04 22:00:00', |
|
|
'The converted date time convert must contains hour') |
|
|
'The converted date time convert must contains hour') |
|
|
date_time_convert = models.mis_builder._utc_midnight( |
|
|
|
|
|
|
|
|
date_time_convert = mis_builder._utc_midnight( |
|
|
date_to_convert, 'Europe/Brussels', add_day=1) |
|
|
date_to_convert, 'Europe/Brussels', add_day=1) |
|
|
self.assertEqual(date_time_convert, '2014-07-05 22:00:00', |
|
|
self.assertEqual(date_time_convert, '2014-07-05 22:00:00', |
|
|
'The converted date time convert must contains hour') |
|
|
'The converted date time convert must contains hour') |
|
|
date_time_convert = models.mis_builder._utc_midnight( |
|
|
|
|
|
|
|
|
date_time_convert = mis_builder._utc_midnight( |
|
|
date_to_convert, 'US/Pacific') |
|
|
date_to_convert, 'US/Pacific') |
|
|
self.assertEqual(date_time_convert, '2014-07-05 07:00:00', |
|
|
self.assertEqual(date_time_convert, '2014-07-05 07:00:00', |
|
|
'The converted date time convert must contains hour') |
|
|
'The converted date time convert must contains hour') |
|
|
date_time_convert = models.mis_builder._utc_midnight( |
|
|
|
|
|
|
|
|
date_time_convert = mis_builder._utc_midnight( |
|
|
date_to_convert, 'US/Pacific', add_day=1) |
|
|
date_to_convert, 'US/Pacific', add_day=1) |
|
|
self.assertEqual(date_time_convert, '2014-07-06 07:00:00', |
|
|
self.assertEqual(date_time_convert, '2014-07-06 07:00:00', |
|
|
'The converted date time convert must contains hour') |
|
|
'The converted date time convert must contains hour') |
|
|