|
15 | 15 | from ietf.utils.test_utils import TestCase |
16 | 16 | from ietf.meeting.models import Meeting |
17 | 17 | from ietf.submit.utils import expirable_submissions, expire_submission, ensure_person_email_info_exists |
18 | | -from ietf.person.models import Person |
| 18 | +from ietf.person.models import Person, Email |
19 | 19 | from ietf.group.models import Group |
20 | 20 | from ietf.doc.models import Document, DocAlias, DocEvent, State, BallotDocEvent, BallotPositionDocEvent, DocumentAuthor |
21 | 21 | from ietf.submit.models import Submission, Preapproval |
@@ -263,14 +263,19 @@ def text_submit_new_wg_xml(self): |
263 | 263 | def text_submit_new_wg_txt_xml(self): |
264 | 264 | self.submit_new_wg(["txt", "xml"]) |
265 | 265 |
|
266 | | - def submit_existing(self, formats): |
| 266 | + def submit_existing(self, formats, change_authors=True): |
267 | 267 | # submit new revision of existing -> supply submitter info -> prev authors confirm |
268 | 268 | draft = make_test_data() |
269 | | - prev_author = draft.documentauthor_set.all()[0] |
| 269 | + if not change_authors: |
| 270 | + draft.documentauthor_set.all().delete() |
| 271 | + ensure_person_email_info_exists('Author Name','author@example.com') |
| 272 | + draft.documentauthor_set.create(author=Email.objects.get(address='author@example.com')) |
| 273 | + else: |
| 274 | + # Make it such that one of the previous authors has an invalid email address |
| 275 | + bogus_email = ensure_person_email_info_exists('Bogus Person',None) |
| 276 | + DocumentAuthor.objects.create(document=draft,author=bogus_email,order=draft.documentauthor_set.latest('order').order+1) |
270 | 277 |
|
271 | | - # Make it such that one of the previous authors has an invalid email address |
272 | | - bogus_email = ensure_person_email_info_exists('Bogus Person',None) |
273 | | - DocumentAuthor.objects.create(document=draft,author=bogus_email,order=draft.documentauthor_set.latest('order').order+1) |
| 278 | + prev_author = draft.documentauthor_set.all()[0] |
274 | 279 |
|
275 | 280 | # pretend IANA reviewed it |
276 | 281 | draft.set_state(State.objects.get(used=True, type="draft-iana-review", slug="not-ok")) |
@@ -316,11 +321,18 @@ def submit_existing(self, formats): |
316 | 321 | self.assertTrue("Confirm submission" in confirm_email["Subject"]) |
317 | 322 | self.assertTrue(name in confirm_email["Subject"]) |
318 | 323 | self.assertTrue(prev_author.author.address in confirm_email["To"]) |
319 | | - # submitter and new author can't confirm |
320 | | - self.assertTrue("author@example.com" not in confirm_email["To"]) |
| 324 | + if change_authors: |
| 325 | + self.assertTrue("author@example.com" not in confirm_email["To"]) |
321 | 326 | self.assertTrue("submitter@example.com" not in confirm_email["To"]) |
322 | 327 | # Verify that mail wasn't sent to know invalid addresses |
323 | 328 | self.assertTrue("unknown-email-" not in confirm_email["To"]) |
| 329 | + if change_authors: |
| 330 | + # Since authors changed, ensure chairs are copied (and that the message says why) |
| 331 | + self.assertTrue("chairs have been copied" in unicode(confirm_email)) |
| 332 | + self.assertTrue("mars-chairs@" in confirm_email["To"].lower()) |
| 333 | + else: |
| 334 | + self.assertTrue("chairs have been copied" not in unicode(confirm_email)) |
| 335 | + self.assertTrue("mars-chairs@" not in confirm_email["To"].lower()) |
324 | 336 |
|
325 | 337 | confirm_url = self.extract_confirm_url(confirm_email) |
326 | 338 |
|
@@ -373,6 +385,9 @@ def test_submit_existing_xml(self): |
373 | 385 | def test_submit_existing_txt_xml(self): |
374 | 386 | self.submit_existing(["txt", "xml"]) |
375 | 387 |
|
| 388 | + def test_submit_existing_txt_preserve_authors(self): |
| 389 | + self.submit_existing(["txt"],change_authors=False) |
| 390 | + |
376 | 391 | def submit_new_individual(self, formats): |
377 | 392 | # submit new -> supply submitter info -> confirm |
378 | 393 | draft = make_test_data() |
@@ -430,6 +445,8 @@ def test_submit_new_individual_txt_xml(self): |
430 | 445 |
|
431 | 446 | def test_submit_update_individual(self): |
432 | 447 | draft = make_test_data() |
| 448 | + draft.group = None |
| 449 | + draft.save() |
433 | 450 | replaces_count = draft.relateddocument_set.filter(relationship_id='replaces').count() |
434 | 451 | name = draft.name |
435 | 452 | rev = '%02d'%(int(draft.rev)+1) |
|
0 commit comments