Verb tense used in Ballot Issued emails now matches whether the LC end date is in the past or future. Fixes issue #2482. Commit ready for merge.

- Legacy-Id: 15679
This commit is contained in:
Jean Mahoney 2018-11-03 03:38:52 +00:00
parent 542a85d949
commit 194d8c89d1
3 changed files with 39 additions and 20 deletions

View file

@ -363,11 +363,13 @@ def generate_issue_ballot_mail(request, doc, ballot):
e = doc.latest_event(LastCallDocEvent, type="sent_last_call")
last_call_expires = e.expires if e else None
last_call_has_expired = last_call_expires and last_call_expires < datetime.datetime.now()
return render_to_string("doc/mail/issue_ballot_mail.txt",
dict(doc=doc,
doc_url=settings.IDTRACKER_BASE_URL + doc.get_absolute_url(),
last_call_expires=last_call_expires,
last_call_has_expired=last_call_has_expired,
needed_ballot_positions=
needed_ballot_positions(doc,
doc.active_ballot().active_ad_positions().values()

View file

@ -413,26 +413,44 @@ class BallotWriteupsTests(TestCase):
def test_issue_ballot(self):
ad = Person.objects.get(user__username="ad")
draft = IndividualDraftFactory(ad=ad)
url = urlreverse('ietf.doc.views_ballot.ballot_writeupnotes', kwargs=dict(name=draft.name))
login_testing_unauthorized(self, "ad", url)
for case in ('none','past','future'):
draft = IndividualDraftFactory(ad=ad)
if case in ('past','future'):
LastCallDocEvent.objects.create(
by=Person.objects.get(name='(System)'),
type='sent_last_call',
doc=draft,
rev=draft.rev,
desc='issued last call',
expires = datetime.datetime.now()+datetime.timedelta(days = 1 if case=='future' else -1)
)
url = urlreverse('ietf.doc.views_ballot.ballot_writeupnotes', kwargs=dict(name=draft.name))
login_testing_unauthorized(self, "ad", url)
empty_outbox()
r = self.client.post(url, dict(
ballot_writeup="This is a test.",
issue_ballot="1"))
self.assertEqual(r.status_code, 200)
draft = Document.objects.get(name=draft.name)
empty_outbox()
r = self.client.post(url, dict(
ballot_writeup="This is a test.",
issue_ballot="1"))
self.assertEqual(r.status_code, 200)
draft = Document.objects.get(name=draft.name)
self.assertTrue(draft.latest_event(type="sent_ballot_announcement"))
self.assertEqual(len(outbox), 2)
self.assertTrue('Ballot issued:' in outbox[-2]['Subject'])
self.assertTrue('iesg@' in outbox[-2]['To'])
self.assertTrue('Ballot issued:' in outbox[-1]['Subject'])
self.assertTrue('drafts-eval@' in outbox[-1]['To'])
self.assertTrue('X-IETF-Draft-string' in outbox[-1])
if case=='none':
self.assertNotIn('call expire', outbox[-1].get_payload(decode=True).decode("utf-8"))
elif case=='past':
self.assertIn('call expired', outbox[-1].get_payload(decode=True).decode("utf-8"))
else:
self.assertIn('call expires', outbox[-1].get_payload(decode=True).decode("utf-8"))
self.client.logout()
self.assertTrue(draft.latest_event(type="sent_ballot_announcement"))
self.assertEqual(len(outbox), 2)
self.assertTrue('Ballot issued:' in outbox[-2]['Subject'])
self.assertTrue('iesg@' in outbox[-2]['To'])
self.assertTrue('Ballot issued:' in outbox[-1]['Subject'])
self.assertTrue('drafts-eval@' in outbox[-1]['To'])
self.assertTrue('X-IETF-Draft-string' in outbox[-1])
def test_edit_approval_text(self):
ad = Person.objects.get(user__username="ad")

View file

@ -4,9 +4,8 @@ Subject: Ballot issued: {{ doc.file_tag }} to {{ doc|std_level_prompt }}
{% filter wordwrap:78 %}Evaluation for {{ doc.file_tag }} can be found at {{ doc_url }}
{% if last_call_expires %}Last call to expire on: {{ last_call_expires }}
{% endif %}{% endfilter %}
{% if last_call_expires %}Last call expire{% if last_call_has_expired %}d{% else %}s{% endif %} on: {{ last_call_expires }}{% endif %}
{% endfilter %}
{% filter wordwrap:78 %}{{ needed_ballot_positions }}{% endfilter %}
{% endautoescape%}