forked from ubccr/coldfront
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #261 from fasrc/cp_allocationrequest_email_reminders
allocationrequest and allocationchangerequest email reminders
- Loading branch information
Showing
8 changed files
with
265 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
|
||
from django.test import TestCase | ||
|
||
from django.utils import timezone | ||
|
||
from coldfront.core.allocation.models import AllocationStatusChoice | ||
from coldfront.core.test_helpers.factories import ( | ||
setup_models, | ||
AllocationFactory, | ||
AllocationChangeRequestFactory, | ||
) | ||
from coldfront.core.allocation.tasks import send_request_reminder_emails | ||
|
||
UTIL_FIXTURES = [ | ||
"coldfront/core/test_helpers/test_data/test_fixtures/ifx.json", | ||
] | ||
|
||
class RequestReminderEmails(TestCase): | ||
|
||
fixtures = UTIL_FIXTURES | ||
|
||
def setUp(self): | ||
"""set up test data""" | ||
setup_models(self) | ||
|
||
# create Allocations with status "new" and "created" dates of 5, 7, and 9 days ago | ||
self.allocation1 = AllocationFactory( | ||
status=AllocationStatusChoice.objects.get(name="New"), | ||
created=timezone.now() - timezone.timedelta(days=5), | ||
) | ||
self.allocation2 = AllocationFactory( | ||
status=AllocationStatusChoice.objects.get(name="New"), | ||
created=timezone.now() - timezone.timedelta(days=7) | ||
) | ||
self.allocation3 = AllocationFactory( | ||
status=AllocationStatusChoice.objects.get(name="New"), | ||
created=timezone.now() - timezone.timedelta(days=9) | ||
) | ||
|
||
# create AllocationChangeRequests with status "pending" and "created" dates of 5, 7, and 9 days ago | ||
self.acr1 = AllocationChangeRequestFactory( | ||
created=timezone.now() - timezone.timedelta(days=5), | ||
) | ||
self.acr2 = AllocationChangeRequestFactory( | ||
created=timezone.now() - timezone.timedelta(days=7) | ||
) | ||
self.acr3 = AllocationChangeRequestFactory( | ||
created=timezone.now() - timezone.timedelta(days=9) | ||
) | ||
|
||
def test_send_request_reminder_emails(self): | ||
"""test send_request_reminder_emails task""" | ||
pending_changerequests, pending_allocations = send_request_reminder_emails() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
This is a notice about pending allocation change requests on Coldfront that are | ||
at least a week old: | ||
--------------------- | ||
{% for change_request, change_attrs in pending_changerequests.items %} | ||
Allocation: {{change_request.allocation}} | ||
|
||
Requested changes: | ||
{% for change_attr in change_attrs %} | ||
{{change_attr.allocation_attribute.allocation_attribute_type.name}} - change to {{change_attr.new_value}} | ||
{% endfor %} | ||
Change it here: {{url_base}}{{change_request.pk}}/ | ||
--------------------- | ||
{% endfor %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
This is a notice about pending allocation requests on Coldfront that are at | ||
least a week old: | ||
--------------------- | ||
{% for allocation in pending_allocations %} | ||
Allocation: {{allocation}} | ||
Review the request here: {{url_base}}{{allocation.pk}}/ | ||
--------------------- | ||
{% endfor %} |