Search code examples
djangokiwi-tcms

Is there a way to override the content of notification email from a test case update in Kiwi TCMS?


Im trying to change the content of the notification email sent after a test case has been updated to better clarify what has been changed. As it is, the content is hard to read.

Went through the link below to configure the other notification content: http://kiwitcms.org/blog/atodorov/2018/08/06/how-to-override-templates-for-kiwi-tcms/

The content of the notification email:

Updated on Tue Aug 20 15:47:18 2019
Updated by Admin

--- notes
+++ notes
@@ -1 +1 @@
-TestTest
+TestTest123123
--- text
+++ text
@@ -10,7 +10,7 @@
 3. item

 *Expected results*:
-
+Test
 1. item
 2. item
 3. item

I managed to replicate the example (from the link) for post_case_delete, post_run_save, and user_registered but the dir(tcms/templates/email/) lacks one for test case updates.

EDIT: It seems that adding dir and txt files for the others will undo the changes made to confirm_registration.

Is there a way to amend how the content is shown in the notification email?


Solution

  • Im trying to change the content of the notification email sent after a test case has been updated to better clarify what has been changed.

    The link you've posted shows how to override templates (HTML, email, any kind of templates). However what context (e.g. which variables) get passed down to the template is up to the backend functions rendering that particular template.

    As it is, the content is hard to read.

    We thought diff is a pretty universal format but if you have other suggestions the best way is to start with opening an issue with examples, maybe a POC pull request.

    In this particular example change history is automatically generated so any change will likely affect everything which deals with history but we need to see examples to comment further.

    EDIT: It seems that adding dir and txt files for the others will undo the changes made to confirm_registration.

    This is unrelated to the original question. Again I will have to see what exactly you are doing to tell you if/where the mistake is. The template engine in Django is trying to use the first template with a given name it finds. The search directory path tells it where to look for these templates. If you are somehow obscuring the files from the blog post then the application will not be able to find them hence you are not seeing the overriden changes you expect to.

    Also follow https://github.com/kiwitcms/Kiwi/issues/1076 (not directly related but in the same domain space).