How to use get_case_notification_recipients method in Kiwi

Best Python code snippet using Kiwi_python

email.py

Source:email.py Github

copy

Full Screen

1# -*- coding: utf-8 -*-2from django.conf import settings3from tcms.core.utils.mailto import send_email_using_threading4def email_case_update(case):5 recipients = get_case_notification_recipients(case)6 cc = case.emailing.get_cc_list()7 if len(recipients) == 0:8 return9 subject = 'TestCase %s has been updated.' % case.pk10 txt = case.latest_text()11 context = {12 'test_case': case, 'test_case_text': txt,13 'test_case_plain_text': txt.get_plain_text(),14 }15 template = settings.CASE_EMAIL_TEMPLATE16 send_email_using_threading(template, subject, recipients, context, cc=cc)17def email_case_deletion(case):18 recipients = get_case_notification_recipients(case)19 cc = case.emailing.get_cc_list()20 if len(recipients) == 0:21 return22 subject = 'TestCase %s has been deleted.' % case.pk23 context = {24 'case': case,25 }26 template = settings.CASE_EMAIL_TEMPLATE27 send_email_using_threading(template, subject, recipients, context, cc=cc)28def get_case_notification_recipients(case):29 recipients = set()30 if case.emailing.auto_to_case_author:31 recipients.add(case.author.email)32 if case.emailing.auto_to_case_tester and case.default_tester:33 recipients.add(case.default_tester.email)34 if case.emailing.auto_to_run_manager:35 managers = case.case_run.values_list('run__manager__email', flat=True)36 recipients.update(managers)37 if case.emailing.auto_to_run_tester:38 run_testers = case.case_run.values_list('run__default_tester__email',39 flat=True)40 recipients.update(run_testers)41 if case.emailing.auto_to_case_run_assignee:42 assignees = case.case_run.values_list('assignee__email', flat=True)...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Kiwi automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful