@@ -68,8 +68,10 @@ def submission_file(name, rev, group, format, templatename, author=None, email=N
6868 name = "%s-%s" % (name , rev ),
6969 group = group or "" ,
7070 author = author .ascii if ascii else author .name ,
71+ asciiAuthor = author .ascii ,
7172 initials = author .initials (),
7273 surname = author .ascii_parts ()[3 ] if ascii else author .name_parts ()[3 ],
74+ asciiSurname = author .ascii_parts ()[3 ],
7375 email = email ,
7476 title = title ,
7577 )
@@ -158,7 +160,7 @@ def do_submission(self, name, rev, group=None, formats=["txt",], author=None):
158160 submission = Submission .objects .get (name = name )
159161 if len (submission .authors ) != 1 :
160162 sys .stderr .write ("\n Author extraction failure.\n " )
161- sys .stderr .write (("Author name used in test: %s\n " % author ). encode ( 'utf8' ))
163+ sys .stderr .write (six . ensure_text ("Author name used in test: %s\n " % author ))
162164 sys .stderr .write ("Author ascii name: %s\n " % author .ascii )
163165 sys .stderr .write ("Author initials: %s\n " % author .initials ())
164166 self .assertEqual (len (submission .authors ), 1 )
@@ -594,6 +596,51 @@ def test_submit_new_individual_xml(self):
594596 def test_submit_new_individual_txt_xml (self ):
595597 self .submit_new_individual (["txt" , "xml" ])
596598
599+ def submit_new_individual_logged_in (self , formats ):
600+ # submit new -> supply submitter info -> done
601+
602+ name = "draft-authorname-testing-logged-in"
603+ rev = "00"
604+ group = None
605+
606+ author = PersonFactory ()
607+ username = author .user .email
608+ self .client .login (username = username , password = username + "+password" )
609+
610+ status_url , author = self .do_submission (name , rev , group , formats , author = author )
611+
612+ # supply submitter info, then draft should be be ready for email auth
613+ mailbox_before = len (outbox )
614+ r = self .supply_extra_metadata (name , status_url , author .name , username , replaces = "" )
615+
616+ self .assertEqual (r .status_code , 302 )
617+ status_url = r ["Location" ]
618+ r = self .client .get (status_url )
619+ self .assertEqual (r .status_code , 200 )
620+ self .assertContains (r , "New version accepted" )
621+
622+ self .assertEqual (len (outbox ), mailbox_before + 2 )
623+ announcement_email = outbox [- 2 ]
624+ self .assertIn (name , announcement_email ["Subject" ])
625+ self .assertIn ('I-D Action:' , announcement_email ["Subject" ])
626+ self .assertIn ('i-d-announce' , announcement_email ["To" ])
627+ notification_email = outbox [- 1 ]
628+ self .assertIn (name , notification_email ["Subject" ])
629+ self .assertIn ("New Version Notification" , notification_email ["Subject" ])
630+ self .assertIn (author .email ().address .lower (), notification_email ["To" ])
631+
632+ draft = Document .objects .get (docalias__name = name )
633+ self .assertEqual (draft .rev , rev )
634+ new_revision = draft .latest_event ()
635+ self .assertEqual (new_revision .type , "new_revision" )
636+ self .assertEqual (new_revision .by .name , author .name )
637+
638+ def test_submit_new_logged_in_txt (self ):
639+ self .submit_new_individual_logged_in (["txt" ])
640+
641+ def test_submit_new_logged_in_xml (self ):
642+ self .submit_new_individual_logged_in (["xml" ])
643+
597644 def test_submit_update_individual (self ):
598645 IndividualDraftFactory (name = 'draft-ietf-random-thing' , states = [('draft' ,'rfc' )], other_aliases = ['rfc9999' ,], pages = 5 )
599646 ad = Person .objects .get (user__username = 'ad' )
@@ -1047,7 +1094,7 @@ def test_submit_missing_author_email(self):
10471094 for e in author .email_set .all ():
10481095 e .delete ()
10491096
1050- files = {"txt" : submission_file (name , rev , group , "txt" , "test_submission.txt" , author = author , ascii = False )[0 ] }
1097+ files = {"txt" : submission_file (name , rev , group , "txt" , "test_submission.txt" , author = author , ascii = True )[0 ] }
10511098
10521099 # submit
10531100 url = urlreverse ('ietf.submit.views.upload_submission' )
0 commit comments