From 6b7c8d8a999eb7e3ec69f94cd5509d35cfd500d9 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Apr 12 2019 10:58:30 +0000 Subject: Include a small introduction text to email on loading files Basically, this introduce the rest of the email which will contain the log about loading the JSON files pushed to the git repositories to the DB, thus allowing to update tickets/PRs from the git repos. Fixes https://pagure.io/pagure/issue/4003 Signed-off-by: Pierre-Yves Chibon --- diff --git a/pagure/lib/tasks_services.py b/pagure/lib/tasks_services.py index eb78d0a..23f0f46 100644 --- a/pagure/lib/tasks_services.py +++ b/pagure/lib/tasks_services.py @@ -308,7 +308,14 @@ def load_json_commits_to_db( file_list = set(get_files_to_load(project.fullname, commits, abspath)) n = len(file_list) _log.info("LOADJSON: %s files to process" % n) - mail_body = [] + mail_body = [ + "Good Morning", + "", + "This is the log of loading all the files pushed in the git repo into", + "the database. It should ignore files that are not JSON files, this", + "is fine.", + "", + ] for idx, filename in enumerate(sorted(file_list)): _log.info( diff --git a/tests/test_pagure_lib_task_services.py b/tests/test_pagure_lib_task_services.py index 866bbeb..300b544 100644 --- a/tests/test_pagure_lib_task_services.py +++ b/tests/test_pagure_lib_task_services.py @@ -332,6 +332,11 @@ class PagureLibTaskServicestests(tests.Modeltests): ) calls = [ call( + u'Good Morning\n\n' + u'This is the log of loading all the files pushed in the git ' + u'repo into\n' + u'the database. It should ignore files that are not JSON files,' + u' this\nis fine.\n\n' u'Loading: file1 -- 1/2 ... ... Done\n' u'Loading: file2 -- 2/2 ... ... Done', u'Issue import report', @@ -380,6 +385,11 @@ class PagureLibTaskServicestests(tests.Modeltests): calls = [ call( + u'Good Morning\n\n' + u'This is the log of loading all the files pushed in the git ' + u'repo into\n' + u'the database. It should ignore files that are not JSON files,' + u' this\nis fine.\n\n' u'Loading: file1 -- 1/2 ... ... FAILED\n', u'Issue import report', u'bar@pingou.com' @@ -805,6 +815,11 @@ class PagureLibTaskServicesLoadJsonTickettests(tests.Modeltests): up_pr.assert_not_called() calls = [ call( + u'Good Morning\n\n' + u'This is the log of loading all the files pushed in the git ' + u'repo into\n' + u'the database. It should ignore files that are not JSON files,' + u' this\nis fine.\n\n' u'Loading: %s -- 1/1 ... ... Done' % issue.uid, u'Issue import report', u'bar@pingou.com'