@@ -752,6 +752,61 @@ def test_document_draft(self):
752752 r = self .client .get (urlreverse ("ietf.doc.views_doc.document_main" , kwargs = dict (name = "draft-xyz123" )))
753753 self .assertEqual (r .status_code , 404 )
754754
755+ def assert_correct_wg_group_link (self , r , group ):
756+ """Assert correct format for WG-like group types"""
757+ self .assertContains (
758+ r ,
759+ '(<a href="%(about_url)s">%(group_acro)s %(group_type)s</a>)' % {
760+ "group_acro" : group .acronym ,
761+ "group_type" : group .type ,
762+ "about_url" : group .about_url (),
763+ },
764+ msg_prefix = 'WG-like group %s (%s) should include group type in link' % (group .acronym , group .type ),
765+ )
766+
767+ def assert_correct_non_wg_group_link (self , r , group ):
768+ """Assert correct format for non-WG-like group types"""
769+ self .assertContains (
770+ r ,
771+ '(<a href="%(about_url)s">%(group_acro)s</a>)' % {
772+ "group_acro" : group .acronym ,
773+ "about_url" : group .about_url (),
774+ },
775+ msg_prefix = 'Non-WG-like group %s (%s) should not include group type in link' % (group .acronym , group .type ),
776+ )
777+
778+ def test_draft_group_link (self ):
779+ """Link to group 'about' page should have correct format"""
780+ for group_type_id in ['wg' , 'rg' , 'ag' ]:
781+ group = GroupFactory (type_id = group_type_id )
782+ draft = WgDraftFactory (name = 'draft-document-%s' % group_type_id , group = group )
783+ r = self .client .get (urlreverse ("ietf.doc.views_doc.document_main" , kwargs = dict (name = draft .name )))
784+ self .assertEqual (r .status_code , 200 )
785+ self .assert_correct_wg_group_link (r , group )
786+
787+ rfc = WgRfcFactory (name = 'draft-rfc-document-%s' % group_type_id , group = group )
788+ DocEventFactory .create (doc = rfc , type = 'published_rfc' , time = '2010-10-10' )
789+ # get the rfc name to avoid a redirect
790+ rfc_name = rfc .docalias .filter (name__startswith = 'rfc' ).first ().name
791+ r = self .client .get (urlreverse ("ietf.doc.views_doc.document_main" , kwargs = dict (name = rfc_name )))
792+ self .assertEqual (r .status_code , 200 )
793+ self .assert_correct_wg_group_link (r , group )
794+
795+ for group_type_id in ['ietf' , 'team' ]:
796+ group = GroupFactory (type_id = group_type_id )
797+ draft = WgDraftFactory (name = 'draft-document-%s' % group_type_id , group = group )
798+ r = self .client .get (urlreverse ("ietf.doc.views_doc.document_main" , kwargs = dict (name = draft .name )))
799+ self .assertEqual (r .status_code , 200 )
800+ self .assert_correct_non_wg_group_link (r , group )
801+
802+ rfc = WgRfcFactory (name = 'draft-rfc-document-%s' % group_type_id , group = group )
803+ DocEventFactory .create (doc = rfc , type = 'published_rfc' , time = '2010-10-10' )
804+ # get the rfc name to avoid a redirect
805+ rfc_name = rfc .docalias .filter (name__startswith = 'rfc' ).first ().name
806+ r = self .client .get (urlreverse ("ietf.doc.views_doc.document_main" , kwargs = dict (name = rfc_name )))
807+ self .assertEqual (r .status_code , 200 )
808+ self .assert_correct_non_wg_group_link (r , group )
809+
755810 def test_document_primary_and_history_views (self ):
756811 IndividualDraftFactory (name = 'draft-imaginary-independent-submission' )
757812 ConflictReviewFactory (name = 'conflict-review-imaginary-irtf-submission' )
0 commit comments