How to use get_plan_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_plan_update(plan):5 recipients = get_plan_notification_recipients(plan)6 if len(recipients) == 0:7 return8 subject = u'TestPlan %s has been updated.' % plan.pk9 send_email_using_threading(settings.PLAN_EMAIL_TEMPLATE, subject,10 recipients, {'plan': plan})11def email_plan_deletion(plan):12 recipients = get_plan_notification_recipients(plan)13 if len(recipients) == 0:14 return15 subject = u'TestPlan %s has been deleted.' % plan.pk16 send_email_using_threading(settings.PLAN_DELELE_EMAIL_TEMPLATE, subject,17 recipients, {'plan': plan})18def get_plan_notification_recipients(plan):19 recipients = set()20 if plan.owner:21 if plan.emailing.auto_to_plan_owner:22 recipients.add(plan.owner.email)23 if plan.emailing.auto_to_plan_author:24 recipients.add(plan.author.email)25 if plan.emailing.auto_to_case_owner:26 case_authors = plan.case.values_list('author__email', flat=True)27 recipients.update(case_authors)28 if plan.emailing.auto_to_case_default_tester:29 case_testers = plan.case.values_list('default_tester__email',30 flat=True)31 recipients.update(case_testers)32 return filter(lambda e: bool(e), recipients)

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