Best Python code snippet using Kiwi_python
email.py
Source: email.py
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)...
Check out the latest blogs from LambdaTest on this topic:
Howdy testers! If you’re reading this article I suggest you keep a diary & a pen handy because we’ve added numerous exciting features to our cross browser testing cloud and I am about to share them with you right away!
Xamarin is an open-source framework that offers cross-platform application development using the C# programming language. It helps to simplify your overall development and management of cross-platform software applications.
There are times when developers get stuck with a problem that has to do with version changes. Trying to run the code or test without upgrading the package can result in unexpected errors.
Greetings folks! With the new year finally upon us, we’re excited to announce a collection of brand-new product updates. At LambdaTest, we strive to provide you with a comprehensive test orchestration and execution platform to ensure the ultimate web and mobile experience.
Lack of training is something that creates a major roadblock for a tester. Often, testers working in an organization are all of a sudden forced to learn a new framework or an automation tool whenever a new project demands it. You may be overwhelmed on how to learn test automation, where to start from and how to master test automation for web applications, and mobile applications on a new technology so soon.
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!