Ejemplo n.º 1
0
    def test_parse_with_replies(self):
        archive_index = ArchiveMessageIndex(MessageDao())
        archive_index.update(test_data_path('fake_patch_with_replies/'))

        self.assertEqual(archive_index.size(), 2)

        patchset = parse_comments(archive_index.find('<patch-message-id>'))
        map_comments_to_gerrit(patchset)
        self.assertEqual(len(patchset.patches), 1)

        patch = patchset.patches[0]

        self.compareCommentsPartialMatch(
            patch.comments,
            [
                # TODO: stop treating this as a comment
                Comment(
                    raw_line=-1,
                    file='',
                    line=-1,
                    message=
                    'On Mon, 31 Aug 2020 at 12:04:46 +0100, The Sender wrote:'
                ),
                Comment(
                    raw_line=18,
                    file='file',
                    line=7,  # TODO: should be 5
                    message='Comment on old line 5, want on line 5 in new file.'
                ),
                Comment(
                    raw_line=20,
                    file='file',
                    line=9,  # TODO: should be 7
                    message='Comment on old line 7, want on line 8 in new file.'
                ),
            ])
Ejemplo n.º 2
0
 def test_update_with_no_changes_to_data(self):
     archive_index = ArchiveMessageIndex(MessageDao())
     archive_index.update('test_data')
     old_size = archive_index.size()
     archive_index.update('test_data')
     self.assertEqual(old_size, archive_index.size())