This commit is contained in:
Fabien BOURGEOIS 2018-02-19 08:01:20 +01:00
parent 896259dd7f
commit 8490e89959
2 changed files with 9 additions and 9 deletions

View File

@ -33,11 +33,11 @@ class TestGolemResource(TransactionCase):
'avaibility_start': '2018-01-01', 'avaibility_start': '2018-01-01',
'avaibility_stop': '2020-01-01' 'avaibility_stop': '2020-01-01'
} }
self.resource = self.env['golem.resource'] self.resource_obj = self.env['golem.resource']
def test_resource_basic(self): def test_resource_basic(self):
""" Test resource bases """ """ Test resource bases """
resource = self.resource.create(self.data) resource = self.resource_obj.create(self.data)
self.assertTrue(resource.active) self.assertTrue(resource.active)
self.assertFalse(resource.validation_required) self.assertFalse(resource.validation_required)
self.assertEqual(resource.avaibility_start, '2018-01-01') self.assertEqual(resource.avaibility_start, '2018-01-01')
@ -49,7 +49,7 @@ class TestGolemResource(TransactionCase):
def test_resource_active(self): def test_resource_active(self):
""" Test resource active """ """ Test resource active """
resource = self.resource.create(self.data) resource = self.resource_obj.create(self.data)
self.assertTrue(resource.active) self.assertTrue(resource.active)
resource.active_toggle() resource.active_toggle()
self.assertFalse(resource.active) self.assertFalse(resource.active)
@ -60,10 +60,10 @@ class TestGolemResource(TransactionCase):
""" Test resource dates : stop can not be after start """ """ Test resource dates : stop can not be after start """
self.data.update({'avaibility_stop': '2017-01-01'}) self.data.update({'avaibility_stop': '2017-01-01'})
with self.assertRaises(ValidationError): with self.assertRaises(ValidationError):
self.resource.create(self.data) self.resource_obj.create(self.data)
def test_resource_dates_equal(self): def test_resource_dates_equal(self):
""" Test resource dates : stop can not be equal to start """ """ Test resource dates : stop can not be equal to start """
self.data.update({'avaibility_stop': self.data['avaibility_start']}) self.data.update({'avaibility_stop': self.data['avaibility_start']})
with self.assertRaises(ValidationError): with self.assertRaises(ValidationError):
self.resource.create(self.data) self.resource_obj.create(self.data)

View File

@ -34,7 +34,7 @@ class TestGolemResourceTimetable(TransactionCase):
'avaibility_start': '2018-01-01', 'avaibility_start': '2018-01-01',
'avaibility_stop': '2020-01-01' 'avaibility_stop': '2020-01-01'
}) })
self.timetable = self.env['golem.resource.timetable'] self.timetable_obj = self.env['golem.resource.timetable']
self.data = {'resource_id': self.resource.id, self.data = {'resource_id': self.resource.id,
'weekday': '0', 'weekday': '0',
'time_start': 8.0, 'time_start': 8.0,
@ -42,7 +42,7 @@ class TestGolemResourceTimetable(TransactionCase):
def test_timetable_basic(self): def test_timetable_basic(self):
""" Test Timetable bases """ """ Test Timetable bases """
timetable = self.timetable.create(self.data) timetable = self.timetable_obj.create(self.data)
self.assertEqual(timetable.resource_id, self.resource) self.assertEqual(timetable.resource_id, self.resource)
self.assertEqual(timetable.time_start, 8.0) self.assertEqual(timetable.time_start, 8.0)
self.assertEqual(timetable.time_stop, 10.0) self.assertEqual(timetable.time_stop, 10.0)
@ -52,7 +52,7 @@ class TestGolemResourceTimetable(TransactionCase):
""" Test timetable times : stop can not be equal or after start """ """ Test timetable times : stop can not be equal or after start """
self.data.update({'time_stop': 7.0}) self.data.update({'time_stop': 7.0})
with self.assertRaises(ValidationError): with self.assertRaises(ValidationError):
self.timetable.create(self.data) self.timetable_obj.create(self.data)
self.data.update({'time_stop': self.data['time_start']}) self.data.update({'time_stop': self.data['time_start']})
with self.assertRaises(ValidationError): with self.assertRaises(ValidationError):
self.timetable.create(self.data) self.timetable_obj.create(self.data)