Browse Source

[UPD] b_shift : unite tests

pull/143/head
Elouan Le Bars 5 years ago
parent
commit
5b41b0c5b0
  1. 19
      beesdoo_shift/tests/test_beesdoo_shift.py

19
beesdoo_shift/tests/test_beesdoo_shift.py

@ -342,8 +342,9 @@ class TestBeesdooShift(TransactionCase):
"task_type_id": self.task_type_2.id, "task_type_id": self.task_type_2.id,
"state": "done", "state": "done",
"attendance_sheet_id": sheet_1.id, "attendance_sheet_id": sheet_1.id,
"worker_id": self.worker_regular_super_1.id,
"worker_id": self.worker_irregular_2.id,
"is_compensation": False, "is_compensation": False,
"is_regular": False,
} }
) )
# Same task type as empty shift (should edit it on validation) # Same task type as empty shift (should edit it on validation)
@ -352,8 +353,9 @@ class TestBeesdooShift(TransactionCase):
"task_type_id": self.task_type_1.id, "task_type_id": self.task_type_1.id,
"state": "done", "state": "done",
"attendance_sheet_id": sheet_1.id, "attendance_sheet_id": sheet_1.id,
"worker_id": self.worker_irregular_2.id,
"worker_id": self.worker_regular_super_1.id,
"is_compensation": True, "is_compensation": True,
"is_regular": False,
} }
) )
@ -460,6 +462,11 @@ class TestBeesdooShift(TransactionCase):
shift_regular.state = "done" shift_regular.state = "done"
self.assertEquals(status_1.sr, 0) self.assertEquals(status_1.sr, 0)
self.assertEquals(status_1.sc, 0) self.assertEquals(status_1.sc, 0)
shift_regular.state = "open"
shift_regular.write({"is_regular": False, "is_compensation": True})
shift_regular.state = "done"
self.assertEquals(status_1.sr, 1)
self.assertEquals(status_1.sc, 0)
# Check unsubscribed status # Check unsubscribed status
status_1.sr = -1 status_1.sr = -1
@ -467,9 +474,11 @@ class TestBeesdooShift(TransactionCase):
# Subscribe him to another future shift # Subscribe him to another future shift
future_shift_regular.worker_id = self.worker_regular_1 future_shift_regular.worker_id = self.worker_regular_1
shift_regular.state = "absent_2"
self.assertEquals(status_1.sr, -2)
self.assertEquals(status_1.sc, -2)
with self.assertRaises(ValidationError) as e:
future_shift_regular.state = "absent_2"
self.assertIn("future", str(e.exception))
status_1.sr = -2
status_1.sc = -2
self.assertEquals(status_1.status, "unsubscribed") self.assertEquals(status_1.status, "unsubscribed")
# Should be unsubscribed from future shift # Should be unsubscribed from future shift

Loading…
Cancel
Save