Browse Source

[FIX] Fix date_start test bug

pull/139/head^2
Agathe Mollé 9 years ago
parent
commit
3a955cf949
  1. 9
      super_calendar/models/super_calendar_configurator.py
  2. 9
      super_calendar/tests/test_super_calendar.py

9
super_calendar/models/super_calendar_configurator.py

@ -157,10 +157,11 @@ class SuperCalendarConfigurator(models.Model):
or 'UTC') or 'UTC')
local_date_start = tz.localize(date_start) local_date_start = tz.localize(date_start)
utc_date_start = local_date_start.astimezone(utc) utc_date_start = local_date_start.astimezone(utc)
date_start = datetime.strftime(
utc_date_start,
tools.DEFAULT_SERVER_DATETIME_FORMAT
)
date_start = utc_date_start
date_start = datetime.strftime(
date_start,
tools.DEFAULT_SERVER_DATETIME_FORMAT
)
super_calendar_values = { super_calendar_values = {
'name': name, 'name': name,

9
super_calendar/tests/test_super_calendar.py

@ -61,7 +61,7 @@ class TestSuperCalendar(TransactionCase):
('model', '=', 'res.partner') ('model', '=', 'res.partner')
]) ])
self.date_start_field = self.ModelFieldsObj.search([ self.date_start_field = self.ModelFieldsObj.search([
('name', '=', 'create_date'),
('name', '=', 'write_date'),
('model', '=', 'res.partner'), ('model', '=', 'res.partner'),
]) ])
self.description_field = self.ModelFieldsObj.search([ self.description_field = self.ModelFieldsObj.search([
@ -82,11 +82,10 @@ class TestSuperCalendar(TransactionCase):
""" """
Test if record values are correctly computed Test if record values are correctly computed
""" """
# Test without any date_stop or duration # Test without any date_stop or duration
values_partner_a = { values_partner_a = {
'configurator_id': self.super_calendar_configurator.id, 'configurator_id': self.super_calendar_configurator.id,
'date_start': self.partner_A.create_date,
'date_start': self.partner_A.write_date,
'duration': False, 'duration': False,
'model_id': self.partner_model.id, 'model_id': self.partner_model.id,
'name': self.partner_A.name, 'name': self.partner_A.name,
@ -105,7 +104,7 @@ class TestSuperCalendar(TransactionCase):
('name', '=', 'date'), ('name', '=', 'date'),
('model', '=', 'res.partner'), ('model', '=', 'res.partner'),
]) ])
start_date = datetime.strptime(self.partner_A.create_date,
start_date = datetime.strptime(self.partner_A.write_date,
DEFAULT_SERVER_DATETIME_FORMAT) DEFAULT_SERVER_DATETIME_FORMAT)
stop_date = datetime.strptime(self.partner_A.date, stop_date = datetime.strptime(self.partner_A.date,
DEFAULT_SERVER_DATE_FORMAT) DEFAULT_SERVER_DATE_FORMAT)
@ -156,5 +155,5 @@ class TestSuperCalendar(TransactionCase):
]) ])
self.assertEqual( self.assertEqual(
super_calendar_record.date_start, super_calendar_record.date_start,
self.partner_A.create_date
self.partner_A.write_date
) )
Loading…
Cancel
Save