Fixes : Only send expiration warnings for drafts with a "draft" state of "active", to match the drafts that we will actually expire. Commit ready for merge.

- Legacy-Id: 18723
This commit is contained in:
Margaret Cullen 2020-12-01 17:05:34 +00:00
parent 0bf56c93c7
commit dbeb0e8d2d
2 changed files with 18 additions and 3 deletions

View file

@ -90,8 +90,10 @@ def in_draft_expire_freeze(when=None):
return second_cut_off <= when < ietf_monday
def send_expire_warning_for_draft(doc):
if doc.get_state_slug("draft-iesg") == "dead":
return # don't warn about dead documents
if ((doc.get_state_slug("draft-iesg") == "dead") or
(doc.get_state_slug("draft") != "active")):
return # don't warn about dead or inactive documents
expiration = doc.expires.date()

View file

@ -632,7 +632,20 @@ class ExpireIDsTests(DraftFileMixin, TestCase):
self.assertTrue('draft-ietf-mars-test@' in outbox[-1]['To']) # Gets the authors
self.assertTrue('mars-chairs@ietf.org' in outbox[-1]['Cc'])
self.assertTrue('aread@' in outbox[-1]['Cc'])
#Check that we don't sent expiration warnings for dead or replaced drafts
old_state = draft.get_state_slug("draft-iesg")
mailbox_before = len(outbox)
draft.set_state(State.objects.get(type_id="draft-iesg",slug="dead"))
send_expire_warning_for_draft(draft)
self.assertEqual(len(outbox), mailbox_before,"Sent expiration warning for dead draft")
draft.set_state(State.objects.get(type_id="draft-iesg",slug=old_state))
mailbox_before = len(outbox)
draft.set_state(State.objects.get(type_id="draft",slug="repl"))
send_expire_warning_for_draft(draft)
self.assertEqual(len(outbox), mailbox_before,"Sent expiration warning for replaced draft")
def test_expire_drafts(self):
mars = GroupFactory(type_id='wg',acronym='mars')
ad_role = RoleFactory(group=mars, name_id='ad', person=Person.objects.get(user__username='ad'))