Explorar o código

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 <pingou@pingoured.fr>
Pierre-Yves Chibon %!s(int64=5) %!d(string=hai) anos
pai
achega
6b7c8d8a99
Modificáronse 2 ficheiros con 23 adicións e 1 borrados
  1. 8 1
      pagure/lib/tasks_services.py
  2. 15 0
      tests/test_pagure_lib_task_services.py

+ 8 - 1
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(

+ 15 - 0
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'