@@ -53,7 +53,7 @@ def submission_file(name, rev, group, format, templatename, author=None, email=N
5353 if author is None :
5454 author = PersonFactory ()
5555 if email is None :
56- email = author .email ().address .lower ()
56+ email = author .email ().address .lower () if author . email () else None
5757 if title is None :
5858 title = "Test Document"
5959 if year is None :
@@ -754,7 +754,7 @@ def test_edit_submission_and_force_post(self):
754754 "authors-1-name" : "Person 2" ,
755755 "authors-1-email" : "person2@example.com" ,
756756 "authors-2-name" : "Person 3" ,
757- "authors-2-email" : "" ,
757+ "authors-2-email" : "person3@example.com " ,
758758 "authors-prefix" : ["authors-" , "authors-0" , "authors-1" , "authors-2" ],
759759 })
760760 self .assertNoFormPostErrors (r , ".has-error,.alert-danger" )
@@ -776,7 +776,7 @@ def test_edit_submission_and_force_post(self):
776776 self .assertEqual (authors [1 ]["name" ], "Person 2" )
777777 self .assertEqual (authors [1 ]["email" ], "person2@example.com" )
778778 self .assertEqual (authors [2 ]["name" ], "Person 3" )
779- self .assertEqual (authors [2 ]["email" ], "" )
779+ self .assertEqual (authors [2 ]["email" ], "person3@example.com " )
780780
781781 self .assertEqual (len (outbox ), mailbox_before + 1 )
782782 self .assertTrue ("Manual Post Requested" in outbox [- 1 ]["Subject" ])
@@ -1038,20 +1038,62 @@ def test_submit_nonascii_name(self):
10381038
10391039 self .assertIn ('The idnits check returned 1 warning' , m )
10401040
1041- def test_submit_invalid_yang (self ):
1042- name = "draft-yang -testing-invalid "
1041+ def test_submit_missing_author_email (self ):
1042+ name = "draft-authorname -testing-noemail "
10431043 rev = "00"
10441044 group = None
10451045
1046- # get
1046+ author = PersonFactory ()
1047+ for e in author .email_set .all ():
1048+ e .delete ()
1049+
1050+ files = {"txt" : submission_file (name , rev , group , "txt" , "test_submission.txt" , author = author , ascii = False )[0 ] }
1051+
1052+ # submit
10471053 url = urlreverse ('ietf.submit.views.upload_submission' )
1048- r = self .client .get (url )
1049- self .assertEqual (r .status_code , 200 )
1054+ r = self .client .post (url , files )
1055+ self .assertEqual (r .status_code , 302 )
1056+ status_url = r ["Location" ]
1057+ r = self .client .get (status_url )
10501058 q = PyQuery (r .content )
1059+ m = q ('p.text-danger' ).text ()
1060+
1061+ self .assertIn ('Author email error' , m )
1062+ self .assertIn ('Found no email address.' , m )
1063+
1064+ def test_submit_bad_author_email (self ):
1065+ name = "draft-authorname-testing-bademail"
1066+ rev = "00"
1067+ group = None
1068+
1069+ author = PersonFactory ()
1070+ email = author .email_set .first ()
1071+ email .address = '@bad.email'
1072+ email .save ()
1073+
1074+ files = {"xml" : submission_file (name , rev , group , "xml" , "test_submission.xml" , author = author , ascii = False )[0 ] }
10511075
10521076 # submit
1053- files = {"txt" : submission_file (name , rev , group , "txt" , "test_submission_invalid_yang.txt" ) }
1077+ url = urlreverse ('ietf.submit.views.upload_submission' )
1078+ r = self .client .post (url , files )
1079+ self .assertEqual (r .status_code , 302 )
1080+ status_url = r ["Location" ]
1081+ r = self .client .get (status_url )
1082+ q = PyQuery (r .content )
1083+ m = q ('p.text-danger' ).text ()
1084+
1085+ self .assertIn ('Author email error' , m )
1086+ self .assertIn ('Invalid email address.' , m )
10541087
1088+ def test_submit_invalid_yang (self ):
1089+ name = "draft-yang-testing-invalid"
1090+ rev = "00"
1091+ group = None
1092+
1093+ # submit
1094+ files = {"txt" : submission_file (name , rev , group , "txt" , "test_submission_invalid_yang.txt" )[0 ] }
1095+
1096+ url = urlreverse ('ietf.submit.views.upload_submission' )
10551097 r = self .client .post (url , files )
10561098 self .assertEqual (r .status_code , 302 )
10571099 status_url = r ["Location" ]
0 commit comments