Esempio n. 1
0
def generate_report(*args, **kwargs):
    to_excel = []
    date = kwargs['date']
    length = kwargs['length']
    email = kwargs['email']
    for variable in Variable.objects.all():
        qs = Measurement.objects.exclude(value=None).filter(variable=variable)
        values = get_data(qs, date, length)
        data = prepare_data(values)
        to_excel.append({
            'variable': variable,
            'real': data,
            'simulate': random_data(data)
        })
    xls = create_excel(to_excel)
    path = 'resume.xls'
    xls.save(path)
    print 'Email sent to %s' % kwargs['email']
    email_data = {
        'email': email,
        'subject': 'Resume for date: %s' % date,
        'body': '',
        'path': path
    }
    Email.send_email_attach(**email_data)
Esempio n. 2
0
def setup(serino):
    chrome = Chrome(serino,"Chrome")
    message = Message(serino,"Message")
    email = Email(serino,"Email")
    call = Telephony(serino,"call")
    
#     chrome.setup()
    message.setup()
    email.setup("*****@*****.**", "Password001", "exchange")
    call.setup_contacts()    
Esempio n. 3
0
def setup(serino):
    chrome = Chrome(serino, "Chrome")
    message = Message(serino, "Message")
    email = Email(serino, "Email")
    call = Telephony(serino, "call")

    #     chrome.setup()
    message.setup()
    email.setup("*****@*****.**", "Password001", "exchange")
    call.setup_contacts()
Esempio n. 4
0
def resume_email(*args, **kwargs):
    student = kwargs["student"]
    emails = [student.email, "*****@*****.**" % student.code]
    data_email = {
        "context": {"student": student},
        "template_name": "repo/email/resume.html",
        "subject": "Register Complete",
        "to": emails,
    }
    Email.send_email(**data_email)
    print "email sent to: " + str(emails)
Esempio n. 5
0
def notify_password_reset(user, new_password, change_password_url):
    from common.mail import Email
    email_data = {
        'template_name': 'perfiles/email/reset_password_notification.html',
        'context': {
            'user': user,
            'new_password': new_password,
            'change_password_url': change_password_url
        },
        'from_email': 'Wawared',
        'subject': 'Cambio de clave de usuario',
        'to': [user.email]
    }
    Email.send_email(**email_data)
Esempio n. 6
0
 def setUpClass(cls):
     serino = "MDEVICE"
     #         serino = "adede7a6"
     if len(sys.argv) > 1:
         serino = sys.argv[1]
     cls.mod = Email(serino, "Email")
     cls.set = Settings(cls.mod.device, "Settings")
Esempio n. 7
0
 def form_valid(self, form):
     User = get_user_model()
     data = form.cleaned_data
     params = {
         'email': data['email'],
         'first_name': data['first_name'],
         'last_name': data['last_name']
     }
     user = User(**params)
     import uuid
     user.password = uuid.uuid4().hex
     user.save()
     email_data = {
         'to': [user.email],
         'subject': 'Registration Successful',
         'context': {'user': user},
         'template_name': 'accounts/email/register_notification.html'
     }
     Email.send_mail(**email_data)
     return super(RegisterView, self).form_valid(form)
Esempio n. 8
0
def signup_email(*args, **kwargs):
    code = kwargs["email"].split("@")[0]
    key = uuid4().hex
    student = Student()
    student.key = key
    student.code = code
    student.save()
    tmp = Tmp()
    tmp.student = student
    tmp.key = key
    tmp.save()
    data_email = {
        "context": {"key": key, "host": kwargs["host"]},
        "template_name": "repo/email/register.html",
        "subject": "Register Successfully",
        "to": [kwargs["email"]],
    }
    print reverse("repo_personal_info", kwargs={"key": tmp.key})
    print "email sent to %s" % kwargs["email"]
    Email.send_email(**data_email)
Esempio n. 9
0
def send_email(*args, **kwargs):
    Email.send_email(**kwargs)
    print 'Email sent to %s' % kwargs['to']
Esempio n. 10
0
from selenium.webdriver.support.ui import Select
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import NoAlertPresentException
import unittest, time, re, sys, os
from page.InspectionPageObject import InspectionPage
from page.BusinessExecutionPageObject import BusinessExecutionPage
from page.TaskControlPageObject import TaskControlPage
from page.LoginPage import LoginPage
from common.Log import logger
from common.config import Config,CONFIG_FILE,LOG_PATH,REPORT_PATH,CASE_PATH,PAGE_PATH
from common.mail import Email
from common.HTMLTestRunner import HTMLTestRunner


if __name__ == '__main__':
    discover = unittest.defaultTestLoader.discover(CASE_PATH,"test_JMTool_r*.py") #执行测试用例路径下的匹配脚本
    nowtime = time.strftime("%Y-%m-%d-%H-%M-%S")
    report = REPORT_PATH + '\\' + nowtime + '_JMTool_report.html'
    with open(report, 'wb') as f:
        runner = HTMLTestRunner(f, verbosity=2, title='JMTool自动化测试报告', description='自动化测试用例参考')
        runner.run(discover)
    e = Email(title='JMTool自动化测试报告',
              message='这是今天的测试报告,请查收!',
              receiver='*****@*****.**', #; [email protected] ; [email protected] ; [email protected]',
              server='smtp.163.com',
              sender='*****@*****.**',
              password='******',
              path=report
              )
    e.send()
  
import unittest
import os, time
from common.file_path import REPORT_PATH, INTERFACE_CASE_PATH
from common.HTMLTestRunner_PY import HTMLTestRunner
from common.mail import Email


def all_case():
    discover = unittest.defaultTestLoader.discover(INTERFACE_CASE_PATH,
                                                   pattern="test_*.py",
                                                   top_level_dir=None)
    return discover


if __name__ == "__main__":
    report_time = time.strftime('%Y%m%d%H%M%S')
    report = os.path.join(REPORT_PATH, report_time + 'YR_report.html')

    with open(report, 'wb') as f:
        runner = HTMLTestRunner(f,
                                verbosity=2,
                                title='YRCLOUD',
                                description='测试')
        runner.run(all_case())

    e = Email()
    e.send()
Esempio n. 12
0
from page.InspectionPageObject import InspectionPage
from page.BusinessExecutionPageObject import BusinessExecutionPage
from page.TaskControlPageObject import TaskControlPage
from page.LoginPage import LoginPage
from common.Log import logger
from common.config import Config, CONFIG_FILE, LOG_PATH, REPORT_PATH, CASE_PATH, PAGE_PATH
from common.mail import Email
from common.HTMLTestRunner import HTMLTestRunner

if __name__ == '__main__':
    discover = unittest.defaultTestLoader.discover(
        CASE_PATH, "test_JMTool_r*.py")  #执行测试用例路径下的匹配脚本
    nowtime = time.strftime("%Y-%m-%d-%H-%M-%S")
    report = REPORT_PATH + '\\' + nowtime + '_JMTool_report.html'
    with open(report, 'wb') as f:
        runner = HTMLTestRunner(f,
                                verbosity=2,
                                title='JMTool自动化测试报告',
                                description='自动化测试用例参考')
        runner.run(discover)
    e = Email(
        title='JMTool自动化测试报告',
        message='这是今天的测试报告,请查收!',
        receiver=
        '*****@*****.**',  #; [email protected] ; [email protected] ; [email protected]',
        server='smtp.163.com',
        sender='*****@*****.**',
        password='******',
        path=report)
    e.send()