Пример #1
0
 def test_generate_email_from_single_email_thread(self):
     email = generate_email_from_file("test_data/patch6.txt")
     self.assertEqual(
         email.subject,
         '[PATCH v2 1/2] Input: i8042 - Prevent intermixing i8042 commands')
     self.assertEqual(email.in_reply_to, None)
     self.assertEqual(email.from_, "Raul E Rangel <*****@*****.**>")
     self.assertTrue(len(email.content) > 0)
Пример #2
0
def main():
    gerrit_git = GerritGit(git_dir='gerrit_git_dirT',
                           cookie_jar_path='gerritcookies',
                           url='http://linux.googlesource.com',
                           project='linux/kernel/git/torvalds/linux',
                           branch='master')
    gerrit_git.shallow_clone(depth=1)
    gerrit_git._git.config('http.cookiefile',
                           '../' + gerrit_git._cookie_jar_path)
    gerrit_git._git.config('user.name', 'lkml-gerrit-bridge')
    gerrit_git._git.config('user.email', '*****@*****.**')
    subprocess.run(CURL_CHANGE_ID_CMD, cwd=gerrit_git._git_dir, shell=True)
    print('Master branch cloned at ' + git('log', cwd='gerrit_git_dirT'))
    patch = archive_converter.generate_email_from_file("file.txt")
    text = 'From: {from_}\nSubject: {subject}\n\n{content}'.format(
        from_=patch.from_, subject=patch.subject, content=patch.content)
    actual_patch = Patch(message_id=patch.id,
                         text=patch.content,
                         text_with_headers=text,
                         set_index=0,
                         comments=[])
    gerrit_git.apply_patch(actual_patch)
Пример #3
0
    def test_parse_comments_for_non_patch_email(self):
        patchset = parse_comments(
            generate_email_from_file('test_data/thread_patch0.txt'))

        self.assertEqual(len(patchset.patches), 0)