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.

51 lines
2.8 KiB

  1. #==============================================================================
  2. # =
  3. # mis_builder module for OpenERP, Management Information System Builder
  4. # Copyright (C) 2014 ACSONE SA/NV (<http://acsone.eu>)
  5. # =
  6. # This file is a part of mis_builder
  7. # =
  8. # mis_builder is free software: you can redistribute it and/or modify
  9. # it under the terms of the GNU Affero General Public License v3 or later
  10. # as published by the Free Software Foundation, either version 3 of the
  11. # License, or (at your option) any later version.
  12. # =
  13. # mis_builder is distributed in the hope that it will be useful,
  14. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. # GNU Affero General Public License v3 or later for more details.
  17. # =
  18. # You should have received a copy of the GNU Affero General Public License
  19. # v3 or later along with this program.
  20. # If not, see <http://www.gnu.org/licenses/>.
  21. # =
  22. #==============================================================================
  23. import openerp.tests.common as common
  24. from openerp.addons.mis_builder import models
  25. DB = common.DB
  26. ADMIN_USER_ID = common.ADMIN_USER_ID
  27. class mis_builder_test(common.TransactionCase):
  28. def setUp(self):
  29. super(mis_builder_test, self).setUp()
  30. def test_datetime_conversion(self):
  31. date_to_convert = '2014-07-05'
  32. date_time_convert = models.mis_builder._utc_midnight(date_to_convert)
  33. self.assertEqual(date_time_convert, '2014-07-05 00:00:00', 'The converted date time convert must contains hour')
  34. date_time_convert = models.mis_builder._utc_midnight(date_to_convert, add_day=1)
  35. self.assertEqual(date_time_convert, '2014-07-06 00:00:00', 'The converted date time convert must contains hour')
  36. def test_fetch_query(self):
  37. # create a report on a model without company_id field : account.analytic.balance
  38. data = self.registry('mis.report.instance').compute(self.cr, self.uid, self.ref('mis_builder.mis_report_instance_test'))
  39. self.assertDictContainsSubset({'rows': [{'description': u'total test', 'name': u'total_test'}],
  40. 'cols': [{'values': {u'total_test': {'val_c': None, 'val': 0, 'val_r': '0'}},
  41. 'name': u'today'}]}, data)
  42. # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: