Exemplo n.º 1
0
 def testDoubleClose(self):
     entry = TrackingEntry(
         user=self.linked_user,
         entry_date=datetime.datetime.today() + datetime.timedelta(days=3),
         start_time=datetime.time(9, 0, 0),
         end_time=datetime.time(20, 45, 0),
         breaks=datetime.time(0, 15, 0),
         daytype="WKDAY",
     )
     entry.full_clean()
     entry.save()
     entry.create_approval_request()
     pending = PendingApproval.objects.get(
         entry=entry
     )
     try:
         # we may be running with a default implementation which
         # doesn't sent e-mails.
         from timetracker.tracker.notifications import (
             send_overtime_notification, send_pending_overtime_notification,
             send_undertime_notification
         )
     except:
         return
     pending.tl_close(True)
     pending.close(True)
     self.assertEqual(len(mail.outbox), 1)
     pending.tl_close(True)
     pending.close(True)
     self.assertEqual(len(mail.outbox), 1)
Exemplo n.º 2
0
 def testDoubleClose(self):
     entry = TrackingEntry(
         user=self.linked_user,
         entry_date=datetime.datetime.today() + datetime.timedelta(days=3),
         start_time=datetime.time(9, 0, 0),
         end_time=datetime.time(20, 45, 0),
         breaks=datetime.time(0, 15, 0),
         daytype="WKDAY",
     )
     entry.full_clean()
     entry.save()
     entry.create_approval_request()
     pending = PendingApproval.objects.get(entry=entry)
     try:
         # we may be running with a default implementation which
         # doesn't sent e-mails.
         from timetracker.tracker.notifications import (
             send_overtime_notification, send_pending_overtime_notification,
             send_undertime_notification)
     except:
         return
     pending.tl_close(True)
     pending.close(True)
     self.assertEqual(len(mail.outbox), 1)
     pending.tl_close(True)
     pending.close(True)
     self.assertEqual(len(mail.outbox), 1)
Exemplo n.º 3
0
 def testIsHolidayRequest(self):
     entry = TrackingEntry(
         user=self.linked_user,
         entry_date=datetime.datetime.today() + datetime.timedelta(days=5),
         start_time=datetime.time(9, 0, 0),
         end_time=datetime.time(20, 45, 0),
         breaks=datetime.time(0, 15, 0),
         daytype="PENDI",
     )
     entry.full_clean()
     entry.save()
     entry.create_approval_request()
     pending = PendingApproval.objects.get(entry=entry)
     self.assertEqual(pending.is_holiday_request(), True)
Exemplo n.º 4
0
 def testTLDeny(self):
     entry = TrackingEntry(
         user=self.linked_user,
         entry_date=datetime.datetime.today() + datetime.timedelta(days=6),
         start_time=datetime.time(9, 0, 0),
         end_time=datetime.time(20, 45, 0),
         breaks=datetime.time(0, 15, 0),
         daytype="WKDAY",
     )
     entry.full_clean()
     entry.save()
     entry.create_approval_request()
     pending = PendingApproval.objects.get(entry=entry)
     pending.tl_close(False)
     self.assertEqual(len(mail.outbox), 1)
Exemplo n.º 5
0
 def testIsHolidayRequest(self):
     entry = TrackingEntry(
         user=self.linked_user,
         entry_date=datetime.datetime.today() + datetime.timedelta(days=5),
         start_time=datetime.time(9, 0, 0),
         end_time=datetime.time(20, 45, 0),
         breaks=datetime.time(0, 15, 0),
         daytype="PENDI",
     )
     entry.full_clean()
     entry.save()
     entry.create_approval_request()
     pending = PendingApproval.objects.get(
         entry=entry
     )
     self.assertEqual(pending.is_holiday_request(), True)
Exemplo n.º 6
0
 def testTLDeny(self):
     entry = TrackingEntry(
         user=self.linked_user,
         entry_date=datetime.datetime.today() + datetime.timedelta(days=6),
         start_time=datetime.time(9, 0, 0),
         end_time=datetime.time(20, 45, 0),
         breaks=datetime.time(0, 15, 0),
         daytype="WKDAY",
     )
     entry.full_clean()
     entry.save()
     entry.create_approval_request()
     pending = PendingApproval.objects.get(
         entry=entry
     )
     pending.tl_close(False)
     self.assertEqual(len(mail.outbox), 1)