@@ -1659,3 +1659,67 @@ def test_local_global_labels(self):
16591659 patch = self .create_email ('[PATCH,RFC] test subject' , self .project2 )
16601660 self .cmp_labels (patch , [self .label_rfc_global ])
16611661 self .assertEqual (patch .name , 'test subject' )
1662+
1663+ def test_cover_patch_inheritance (self ):
1664+ cover_msgid = make_msgid ()
1665+ cover_email = create_email (
1666+ 'test cover letter' ,
1667+ msgid = cover_msgid ,
1668+ subject = '[RFC,label2,0/2] a cover letter' ,
1669+ listid = self .project .listid ,
1670+ )
1671+ _parse_mail (cover_email )
1672+ cover = Cover .objects .filter (msgid = cover_msgid )[0 ]
1673+ self .cmp_labels (cover , [self .label_rfc , self .label2 ])
1674+
1675+ patch1_msgid = make_msgid ()
1676+ patch = self .create_email (
1677+ '[label,PATCH,1/2] test patch' ,
1678+ self .project ,
1679+ in_reply_to = cover_msgid ,
1680+ msgid = patch1_msgid ,
1681+ )
1682+ self .cmp_labels (patch , [self .label , self .label_rfc , self .label2 ])
1683+
1684+ patch2 = self .create_email (
1685+ '[PATCH,2/2] test patch' ,
1686+ self .project ,
1687+ in_reply_to = patch1_msgid ,
1688+ )
1689+ self .cmp_labels (patch2 , [self .label_rfc , self .label2 ])
1690+
1691+ def test_cover_patch_inheritance_out_of_order (self ):
1692+ cover_msgid = make_msgid ()
1693+
1694+ patch1_msgid = make_msgid ()
1695+ patch1 = self .create_email (
1696+ '[label,PATCH,1/2] test patch' ,
1697+ self .project ,
1698+ in_reply_to = cover_msgid ,
1699+ msgid = patch1_msgid ,
1700+ )
1701+ self .cmp_labels (patch1 , [self .label ])
1702+
1703+ patch2 = self .create_email (
1704+ '[PATCH,2/2] test patch' ,
1705+ self .project ,
1706+ in_reply_to = patch1_msgid ,
1707+ )
1708+ self .cmp_labels (patch2 , [])
1709+
1710+ cover_email = create_email (
1711+ 'test cover letter' ,
1712+ msgid = cover_msgid ,
1713+ subject = '[RFC,0/2] a cover letter' ,
1714+ listid = self .project .listid ,
1715+ )
1716+ _parse_mail (cover_email )
1717+ cover = Cover .objects .get (msgid = cover_msgid )
1718+
1719+ self .cmp_labels (cover , [self .label_rfc ])
1720+
1721+ patch1 = Patch .objects .get (msgid = patch1_msgid )
1722+ self .cmp_labels (patch1 , [self .label , self .label_rfc ])
1723+
1724+ patch2 = Patch .objects .get (msgid = patch2 .msgid )
1725+ self .cmp_labels (patch2 , [self .label_rfc ])
0 commit comments