def testApprovalRequired(self): # pragma: no cover if not settings.SENDING_APPROVAL.get(self.linked_manager.market): return approval = PendingApproval(entry=self.ot_entry, approver=self.linked_manager) approval.inform_manager() self.assertEqual(len(mail.outbox), 1)
def testNoApprovalRequired(self): # pragma: no cover if not settings.SENDING_APPROVAL.get(self.linked_manager.market): return approval = PendingApproval( entry=self.entry, approver=self.linked_manager ) approval.inform_manager() self.assertEqual(len(mail.outbox), 0)
def test_approvalonpendingtest(self): self.pending_entry.save() approval = PendingApproval( entry=self.pending_entry, approver=self.linked_manager ) approval.save() approval.close(True) self.assertEqual(approval.entry.daytype, "HOLIS")
def doapprovaltest(self, status, message, attachments): approval = PendingApproval( entry=self.ot_entry, approver=self.linked_manager ) approval.save() approval.close(status) self.assertEqual(len(mail.outbox), 1) self.assertEqual(mail.outbox[0].subject, message) self.assertEqual(len(mail.outbox[0].attachments), attachments)
def create_approval_request(self): '''create_approval_request will take this entry and create a PendingApproval entry pointing back to this one.''' # to avoid circular import dependencies from timetracker.overtime.models import PendingApproval if self.pending(): return if not self.overtime_notification_check() and \ not self.undertime_notification_check() and \ not self.daytype == "PENDI": return approval_request = PendingApproval( entry=self, approver=self.user.get_administrator() ) approval_request.save() approval_request.inform_manager()
def test_approvalonpendingtest(self): self.pending_entry.save() approval = PendingApproval(entry=self.pending_entry, approver=self.linked_manager) approval.save() approval.close(True) self.assertEqual(approval.entry.daytype, "HOLIS")
def doapprovaltest(self, status, message, attachments): approval = PendingApproval(entry=self.ot_entry, approver=self.linked_manager) approval.save() approval.close(status) self.assertEqual(len(mail.outbox), 1) self.assertEqual(mail.outbox[0].subject, message) self.assertEqual(len(mail.outbox[0].attachments), attachments)
def create_approval_request(self): '''create_approval_request will take this entry and create a PendingApproval entry pointing back to this one.''' # to avoid circular import dependencies from timetracker.overtime.models import PendingApproval if self.pending(): return if not self.overtime_notification_check() and \ not self.undertime_notification_check() and \ not self.daytype == "PENDI": return approval_request = PendingApproval( entry=self, approver=self.user.get_administrator()) approval_request.save() approval_request.inform_manager()