Skip to content

Commit cea2e8e

Browse files
committed
Merged in [8504] from rjsparks@nostrum.com:\n Added tests that would have caught bug ietf-tools#1508. Added message to edit_shepherd_email to match that added in edit_shepherd.
- Legacy-Id: 8531 Note: SVN reference [8504] has been migrated to Git commit 905df23
2 parents 78da505 + 905df23 commit cea2e8e

2 files changed

Lines changed: 17 additions & 2 deletions

File tree

ietf/doc/tests_draft.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -843,10 +843,16 @@ def test_doc_change_shepherd(self):
843843
self.assertEqual(r.status_code,302)
844844
self.doc = Document.objects.get(name=self.docname)
845845
self.assertEqual(self.doc.shepherd, plain_email)
846-
comments = '::'.join([x.desc for x in self.doc.docevent_set.filter(time=self.doc.time,type="added_comment")])
846+
comment_events = self.doc.docevent_set.filter(time=self.doc.time,type="added_comment")
847+
comments = '::'.join([x.desc for x in comment_events])
847848
self.assertTrue('Document shepherd changed to Plain Man' in comments)
848849
self.assertTrue('Notification list changed' in comments)
849850

851+
# save the form without changing the email (nothing should be saved)
852+
r = self.client.post(url, dict(shepherd=plain_email.pk))
853+
self.assertEqual(r.status_code, 302)
854+
self.assertEqual(set(comment_events), set(self.doc.docevent_set.filter(time=self.doc.time,type="added_comment")))
855+
850856
# test buggy change
851857
ad = Person.objects.get(name='Aread Irector')
852858
two_answers = "%s,%s" % (plain_email, ad.email_set.all()[0])
@@ -881,7 +887,14 @@ def test_doc_change_shepherd_email(self):
881887
self.assertEqual(r.status_code, 302)
882888
self.doc = Document.objects.get(name=self.docname)
883889
self.assertEqual(self.doc.shepherd, new_email)
884-
self.assertTrue(self.doc.latest_event(DocEvent, type="added_comment").desc.startswith('Document shepherd email changed'))
890+
comment_event = self.doc.latest_event(DocEvent, type="added_comment")
891+
self.assertTrue(comment_event.desc.startswith('Document shepherd email changed'))
892+
893+
# save the form without changing the email (nothing should be saved)
894+
r = self.client.post(url, dict(shepherd=new_email))
895+
self.assertEqual(r.status_code, 302)
896+
self.assertEqual(comment_event, self.doc.latest_event(DocEvent, type="added_comment"))
897+
885898

886899
def test_doc_view_shepherd_writeup(self):
887900
url = urlreverse('doc_shepherd_writeup',kwargs=dict(name=self.docname))

ietf/doc/views_draft.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,6 +1025,8 @@ def change_shepherd_email(request, name):
10251025
c = DocEvent(type="added_comment", doc=doc, by=request.user.person)
10261026
c.desc = "Document shepherd email changed"
10271027
c.save()
1028+
else:
1029+
messages.info(request,"The selected shepherd address was already assigned - no changes have been made.")
10281030

10291031
return redirect('doc_view', name=doc.name)
10301032

0 commit comments

Comments
 (0)