Skip to content

Commit

Permalink
#280 Fix ApplicantDeadlineReminderCronJobTest and CloseInforequestsCr… (
Browse files Browse the repository at this point in the history
#415)

* #280 Fix ApplicantDeadlineReminderCronJobTest and CloseInforequestsCronJobTest tests

* #280 Remove unused import

* #280 Create reload_for_context

* #280 Review

Co-authored-by: Martin Macko <[email protected]>
  • Loading branch information
viliambalaz and martinmacko47 authored Jul 29, 2021
1 parent 2328eae commit f22ea51
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 80 deletions.
4 changes: 4 additions & 0 deletions chcemvediet/apps/inforequests/cron.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ def applicant_deadline_reminder():
# deadline reminder for the action.
if action.last_deadline_reminder:
continue
nop() # To let tests raise testing exception here.
filtered.append(branch)
except Exception:
msg = u'Checking if applicant deadline reminder should be sent failed: {}\n{}'
Expand All @@ -160,6 +161,7 @@ def applicant_deadline_reminder():
try:
with transaction.atomic():
branch.inforequest.send_applicant_deadline_reminder(branch.last_action)
nop() # To let tests raise testing exception here.
msg = u'Sent applicant deadline reminder: {}'
cron_logger.info(msg.format(branch.last_action))
except Exception:
Expand Down Expand Up @@ -187,6 +189,7 @@ def close_inforequests():
else:
# Every branch that has a deadline have been missed for at least
# DAYS_TO_CLOSE_INFOREQUEST calendar days.
nop() # To let tests raise testing exception here.
filtered.append(inforequest)
except Exception:
msg = u'Checking if inforequest should be closed failed: {}\n{}'
Expand All @@ -200,6 +203,7 @@ def close_inforequests():
branch.add_expiration_if_expired()
inforequest.closed = True
inforequest.save(update_fields=[u'closed'])
nop() # To let tests raise testing exception here.
cron_logger.info(u'Closed inforequest: {}'.format(inforequest))
except Exception:
msg = u'Closing inforequest failed: {}\n{}'
Expand Down
Loading

0 comments on commit f22ea51

Please sign in to comment.