def testPartialReferences(self): """Tests using the db to get the full list of references, for emails that only have partial list of ancestors in their References header""" series = TestSeries(3) mails = series.create_mails() self.setMessageId(mails[1], 'patch_1_3_v1') self.setMessageId(mails[2], 'patch_2_3_v1') self.setMessageId(mails[3], 'patch_3_3_v1') # review of patch 2/3 reply_1 = series.create_reply(mails[2]) mails.append(reply_1) self.setMessageId(reply_1, 'reply_1') # reply to the review reply_2 = series.create_reply(reply_1) mails.append(reply_2) self.setMessageId(reply_2, 'reply_2') # let's add yet another reply reply_3 = series.create_reply(reply_2) mails.append(reply_3) self.setMessageId(reply_3, 'reply_3') # now a revised patch (v2), which won't have the whole reference chain patch_v2 = series.create_patch(2, in_reply_to=reply_3, subject_prefix="PATCH v2") mails.append(patch_v2) self.setMessageId(patch_v2, 'patch_2_3_v2') # for good measure, a reply to that new patch reply_4 = series.create_reply(patch_v2) mails.append(reply_4) self.setMessageId(reply_4, 'reply_4') series.insert(mails) # and now the v3 of that patch, we'll need to reconstruct the full # list of references patch_v3 = series.create_patch(2, in_reply_to=reply_4, subject_prefix="PATCH v3") self.setMessageId(patch_v3, 'patch_2_3_v3') self.assertEquals(build_references_list(patch_v3), [ reply_4.get('Message-Id'), patch_v2.get('Message-Id'), reply_3.get('Message-Id'), reply_2.get('Message-Id'), reply_1.get('Message-Id'), mails[2].get('Message-Id'), mails[0].get('Message-Id') ])
def testPartialReferences(self): """Tests using the db to get the full list of references, for emails that only have partial list of ancestors in their References header""" series = TestSeries(3) mails = series.create_mails() self.setMessageId(mails[1], "patch_1_3_v1") self.setMessageId(mails[2], "patch_2_3_v1") self.setMessageId(mails[3], "patch_3_3_v1") # review of patch 2/3 reply_1 = series.create_reply(mails[2]) mails.append(reply_1) self.setMessageId(reply_1, "reply_1") # reply to the review reply_2 = series.create_reply(reply_1) mails.append(reply_2) self.setMessageId(reply_2, "reply_2") # let's add yet another reply reply_3 = series.create_reply(reply_2) mails.append(reply_3) self.setMessageId(reply_3, "reply_3") # now a revised patch (v2), which won't have the whole reference chain patch_v2 = series.create_patch(2, in_reply_to=reply_3, subject_prefix="PATCH v2") mails.append(patch_v2) self.setMessageId(patch_v2, "patch_2_3_v2") # for good measure, a reply to that new patch reply_4 = series.create_reply(patch_v2) mails.append(reply_4) self.setMessageId(reply_4, "reply_4") series.insert(mails) # and now the v3 of that patch, we'll need to reconstruct the full # list of references patch_v3 = series.create_patch(2, in_reply_to=reply_4, subject_prefix="PATCH v3") self.setMessageId(patch_v3, "patch_2_3_v3") self.assertEquals( build_references_list(patch_v3), [ reply_4.get("Message-Id"), patch_v2.get("Message-Id"), reply_3.get("Message-Id"), reply_2.get("Message-Id"), reply_1.get("Message-Id"), mails[2].get("Message-Id"), mails[0].get("Message-Id"), ], )
def testThread2Mails(self): series = TestSeries(1) mails = series.create_mails() refs = build_references_list(mails[1]) self.assertEquals(len(refs), 1) self.assertEquals(refs[0], mails[0].get('Message-Id'))
def testSingleMail(self): series = TestSeries(1, has_cover_letter=False) mails = series.create_mails() refs = build_references_list(mails[0]) self.assertEquals(refs, [])