forked from Yaltik/golem
mise à jours du test avec date_start et date_stop
This commit is contained in:
parent
41876e19c0
commit
0dda362d78
@ -217,7 +217,7 @@ class GolemResourceReservation(models.Model):
|
|||||||
if is_day_allowed and (hour_start < timetable.time_start or \
|
if is_day_allowed and (hour_start < timetable.time_start or \
|
||||||
hour_stop > timetable.time_stop):
|
hour_stop > timetable.time_stop):
|
||||||
verr = _('Not allowed, the resource is not available '
|
verr = _('Not allowed, the resource is not available '
|
||||||
'during this schedule, please choose another '
|
'during this period, please choose another '
|
||||||
'time before confirming.')
|
'time before confirming.')
|
||||||
raise ValidationError(verr)
|
raise ValidationError(verr)
|
||||||
if not is_day_allowed:
|
if not is_day_allowed:
|
||||||
|
@ -170,3 +170,24 @@ class TestGolemResourceReservation(TransactionCase):
|
|||||||
with self.assertRaises(ValidationError) as err:
|
with self.assertRaises(ValidationError) as err:
|
||||||
reservation.state_confirm()
|
reservation.state_confirm()
|
||||||
self.assertIn(u'merci de choisir d\'autres horaires', err.exception.args[0])
|
self.assertIn(u'merci de choisir d\'autres horaires', err.exception.args[0])
|
||||||
|
|
||||||
|
def test_confirmed_other_res(self):
|
||||||
|
""" Test if there are other reservations in conflict """
|
||||||
|
reservation = self.res_obj.create(self.data)
|
||||||
|
reservation.state_confirm()
|
||||||
|
reservation2 = self.res_obj.create({
|
||||||
|
'resource_id': self.resource.id,
|
||||||
|
'date_start': '2018-02-05 10:00:00',
|
||||||
|
'date_stop': '2018-02-05 11:00:00',
|
||||||
|
'partner_id': self.partner.id
|
||||||
|
})
|
||||||
|
reservation2.state_confirm()
|
||||||
|
reservation3 = self.res_obj.create({
|
||||||
|
'resource_id': self.resource.id,
|
||||||
|
'date_start': '2018-02-05 11:20:00',
|
||||||
|
'date_stop': '2018-02-05 11:40:00',# Conflict with 2nd res
|
||||||
|
'partner_id': self.partner.id
|
||||||
|
})
|
||||||
|
with self.assertRaises(ValidationError) as err:
|
||||||
|
reservation3.state_confirm()
|
||||||
|
self.assertIn(u'déjà réservée durant cette période', err.exception.args[0])
|
||||||
|
Loading…
Reference in New Issue
Block a user