You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
992 B

  1. # -*- coding: utf-8 -*-
  2. # © 2014-2015 ACSONE SA/NV (<http://acsone.eu>)
  3. # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
  4. import odoo.tests.common as common
  5. from ..models.mis_report import _utc_midnight
  6. class TestUtcMidnight(common.TransactionCase):
  7. def test_utc_midnight(self):
  8. date_to_convert = '2014-07-05'
  9. date_time_convert = _utc_midnight(
  10. date_to_convert, 'Europe/Brussels')
  11. self.assertEqual(date_time_convert, '2014-07-04 22:00:00')
  12. date_time_convert = _utc_midnight(
  13. date_to_convert, 'Europe/Brussels', add_day=1)
  14. self.assertEqual(date_time_convert, '2014-07-05 22:00:00')
  15. date_time_convert = _utc_midnight(
  16. date_to_convert, 'US/Pacific')
  17. self.assertEqual(date_time_convert, '2014-07-05 07:00:00')
  18. date_time_convert = _utc_midnight(
  19. date_to_convert, 'US/Pacific', add_day=1)
  20. self.assertEqual(date_time_convert, '2014-07-06 07:00:00')