Exemplo n.º 1
0
def send_email_with_attachment(content, header, file_path,rev_addr_lst,
                               host= Config.DefaultConfig().Email.Domain,
                               username= Config.DefaultConfig().Email.Sender,
                               password= Config.DefaultConfig().Email.Password, 
                               sender_addr= Config.DefaultConfig().Email.Sender ) :
    """
    @author: eason.sun
    @content:邮件发送的主要内容
    @header:邮件发送的头部
    @file_path:附件在本地的路径 
    @username:邮件发件人账号
    @password:邮件发件人账号密码
    @sender_addr:邮件发送时,发件人显示地址
    @rev_addr_lst:收件人列表  
    @return None
    @summary: 用于发送邮件内容,内容只带有一个附件
    """
    smtp = smtplib.SMTP()
    smtp.connect(host)
    smtp.login(username, password)
    
    main_msg = email.MIMEMultipart.MIMEMultipart()
    main_msg["Subject"] = Header(header, "utf-8")
    
    text_msg = email.MIMEText.MIMEText(content, _subtype = "html", _charset = "utf-8")
    main_msg.attach(text_msg)
    
    file_attach = MIMEApplication(open(file_path,'rb').read())
    file_attach.add_header('Content-Disposition', 'attachment', filename=os.path.basename(file_path))
    main_msg.attach(file_attach)
    
    try:
        smtp.sendmail(sender_addr, rev_addr_lst, main_msg.as_string())
    finally:
        smtp.quit()
Exemplo n.º 2
0
def send_email(content, header,  rev_addr_lst,
                            host= Config.DefaultConfig().Email.Domain,
                            username= Config.DefaultConfig().Email.Sender,
                            password= Config.DefaultConfig().Email.Password, 
                            sender_addr= Config.DefaultConfig().Email.Sender ):
    """
    @author: eason.sun
    @content:邮件发送的主要内容
    @header:邮件发送的头部
    @username:邮件发件人账号
    @password:邮件发件人账号密码
    @sender_addr:邮件发送时,发件人显示地址
    @rev_addr_lst:收件人列表    
    
    @return: None
    
    @summary: 用于发送邮件内容,内容仅限文本内容
    """
    send_msg = MIMEText(content, _subtype = "html", _charset = "utf-8")
    send_msg["Subject"] = Header(header, "utf-8")
    smtp = smtplib.SMTP()
    smtp.connect(host)
    smtp.login(username, password)
    smtp.sendmail(sender_addr, rev_addr_lst, send_msg.as_string())
    smtp.quit()
Exemplo n.º 3
0
def api_response_result_data(resp_dict):
    """
    @author: june.chen
    @resp_dict: 待比对的字典集和
    @return: data空值校验 True/False
    @summary: 返回的data是否为空
    """
    Logger.info("检查返回的data是否为空")
    if resp_dict.has_key(Config.ApiConfig().ResponseStruct.ErrorCodeKey):
        if resp_dict[Config.ApiConfig().ResponseStruct.ErrorCodeKey] != 0:
            Logger.info("API接口数据返回的错误码errorCode不等于0")
            return False
    else:
        Logger.info("API接口数据中不存在错误码")
        return False

    if resp_dict.has_key(Config.ApiConfig().ResponseStruct.DataKey):
        data = Config.ApiConfig().ResponseStruct.DataKey
        if resp_dict[data] == [] or resp_dict[data] == '' or resp_dict[
                data] == {} or resp_dict[data] == None:
            Logger.info("API接口数据中data为空")
            return False
        else:
            Logger.info("API接口数据中data不为空")
            return True
    else:
        Logger.info("API接口数据没有查询数据返回")
        return False
Exemplo n.º 4
0
def test_get_heartbeat():
    Logger.info('-------------------开始执行用例:【电视剧心跳:正常】--------------------')
    url = Config.HttpConfig().heartbeat.url + '?' + Config.HttpConfig(
    ).heartbeat.param1
    data = {'callback': Config.HttpConfig().heartbeat.param1}
    common_itemconfig_result = Common.revoke_get_request(url, data)
    Response.http_code_check(Config.HttpConfig().heartbeat.resp,
                             common_itemconfig_result)
    Verify.IsTrue(
        Common.get_http_code(url, data) == requests.codes.ok,
        Config.HttpConfig().REQ_CODE)
    Logger.info('-------------------结束执行用例:【电视剧心跳:正常】--------------------')
Exemplo n.º 5
0
def http_request_result(params_dict, host = ""):
    """
    @author: eason.sun
    @param_dict: http请求的数据(字典类型)
    @host: http请求的URL
    @return: 返回处理后的POST请求结果
    @summary: 获取HTTP响应结果后,将数据进行格式化
    """    
    if not len(host):
        host = Config.HttpConfig().URL
    # 获取POST请求返回的结果
    post_response = post_request_result(params_dict, host)
    # 将部分null值的返回值设置为空字符串
    post_response = post_response.read().replace("null", '""')
    # false替换为False,true替换为True
    post_response = post_response.replace("false", "False").replace("true", "True")
    # 以字典集返回结果
    dict_post = eval(post_response)
    # API定义所有返回结果都保存在data键中
    post_data = dict_post["data"]
    if type(post_data) == dict: # 返回data的类型为dict,则结果为单条记录
        result_escape(post_data)
    elif type(post_data) == list: # 返回data的类型为list,则结果为多条记录
        post_data = [result_escape(post_item) for post_item in post_data]
    return dict_post
def test_save_Comment_topic():
    Logger.info('-------------------开始执行用例:【发表评论 :正常】--------------------')
    url = Config.HttpConfig_ronghe3().URL + Config.HttpConfig_ronghe3(
    ).saveComment.path + '?' + Config.HttpConfig_ronghe3(
    ).saveComment.param1 + '&' + Config.HttpConfig_ronghe3(
    ).saveComment.param2 + '&' + Config.HttpConfig_ronghe3(
    ).saveComment.param3 + '&' + Config.HttpConfig_ronghe3(
    ).saveComment.param4 + '&' + Config.HttpConfig_ronghe3(
    ).saveComment.param5 + '&' + Config.HttpConfig_ronghe3().saveComment.param6
    data = {}
    common_itemconfig_result = Common.revoke_get_request(url, data)
    Response.http_code_check(Config.HttpConfig_ronghe3().saveComment.resp,
                             common_itemconfig_result)
    Verify.IsTrue(
        Common.get_http_code(url, data) == requests.codes.ok,
        Config.HttpConfig_ronghe3().REQ_CODE)
    Logger.info('-------------------结束执行用例:【发表评论 :正常】--------------------')
Exemplo n.º 7
0
def test_get_Tvanswer():
    Logger.info('-------------------开始执行用例:【电视剧答题:正常】--------------------')
    url = Config.HttpConfig().getTvAnswer.url + '?' + Config.HttpConfig(
    ).getTvAnswer.param1 + '&' + Config.HttpConfig(
    ).getTvAnswer.param2 + '&' + Config.HttpConfig(
    ).getTvAnswer.param3 + '&' + Config.HttpConfig(
    ).getTvAnswer.param4 + '&' + Config.HttpConfig().getTvAnswer.param5
    data = {
        'callback': Config.HttpConfig().getTvAnswer.param1,
        'channelCode': Config.HttpConfig().getTvAnswer.param2
    }
    common_itemconfig_result = Common.revoke_get_request(url, data)
    Response.http_code_check(Config.HttpConfig().getTvAnswer.resp,
                             common_itemconfig_result)
    Verify.IsTrue(
        Common.get_http_code(url, data) == requests.codes.ok,
        Config.HttpConfig().REQ_CODE)
    Logger.info('-------------------结束执行用例:【电视剧答题:正常】--------------------')
Exemplo n.º 8
0
def test_insertOrUpdate_Address_cash():
    Logger.info('-------------------开始执行用例:【更改地址:正常】--------------------')
    url = Config.HttpConfig_cashmall().URL + Config.HttpConfig_cashmall(
    ).insertOrUpdateAddress.path + '?' + Config.HttpConfig_cashmall(
    ).insertOrUpdateAddress.param1 + '&' + Config.HttpConfig_cashmall(
    ).insertOrUpdateAddress.param2 + '&' + Config.HttpConfig_cashmall(
    ).insertOrUpdateAddress.param3 + '&' + Config.HttpConfig_cashmall(
    ).insertOrUpdateAddress.param4 + '&' + Config.HttpConfig_cashmall(
    ).insertOrUpdateAddress.param5 + '&' + Config.HttpConfig_cashmall(
    ).insertOrUpdateAddress.param6
    data = {}
    common_itemconfig_result = Common.revoke_get_request(url, data)
    Response.http_code_check(
        Config.HttpConfig_cashmall().insertOrUpdateAddress.resp,
        common_itemconfig_result)
    Verify.IsTrue(
        Common.get_http_code(url, data) == requests.codes.ok,
        Config.HttpConfig_cashmall().REQ_CODE)
    Logger.info('-------------------结束执行用例:【更改地址:正常】--------------------')
Exemplo n.º 9
0
 def navigate(self, n_url):
     Logger.info("浏览器正在跳转页面:%s" % n_url)
     self.driver.get(n_url)
     if not self.wait_until_complete():
         return False
     self.init_time = self.timing(Config.WebConfig().Timing.InitTime)
     self.redirect_time = self.timing(
         Config.WebConfig().Timing.RedirectTime)
     self.appcache_time = self.timing(
         Config.WebConfig().Timing.AppCacheTime)
     self.dns_time = self.timing(Config.WebConfig().Timing.DnsTime)
     self.tcp_time = self.timing(Config.WebConfig().Timing.TcpTime)
     self.request_time = self.timing(Config.WebConfig().Timing.RequestTime)
     self.response_time = self.timing(
         Config.WebConfig().Timing.ResponseTime)
     self.processing_time = self.timing(
         Config.WebConfig().Timing.ProcessingTime)
     self.onload_time = self.timing(Config.WebConfig().Timing.OnloadTime)
     self.total_time = self.timing(Config.WebConfig().Timing.TotalTime)
     self.timing_detail()
     return True
Exemplo n.º 10
0
def test_get_commentA():
    Logger.info('-------------------开始执行用例:【发表评论:正常】--------------------')
    url = Config.HttpConfig().comment.url + '?' + Config.HttpConfig(
    ).comment.param1 + '&' + Config.HttpConfig(
    ).comment.param2 + '&' + Config.HttpConfig(
    ).comment.param3 + '&' + Config.HttpConfig(
    ).comment.param4 + '&' + Config.HttpConfig(
    ).comment.param5 + '&' + Config.HttpConfig().comment.param6
    data = {'callback': "", 'channelCode': ""}
    common_itemconfig_result = Common.revoke_get_request(url, data)
    Response.http_code_check(Config.HttpConfig().comment.resp,
                             common_itemconfig_result)
    #Verify.IsTrue(Common.get_http_code(url, data) == requests.codes.ok, Config.HttpConfig().REQ_CODE)
    Logger.info('-------------------结束执行用例:【发表评论:正常】--------------------')
Exemplo n.º 11
0
def test_get_BannerPool():
    Logger.info('-------------------开始执行用例:【获取banner:正常】--------------------')
    url = Config.HttpConfig_cashmall().URL + Config.HttpConfig_cashmall(
    ).getBannerPool.path + '?' + Config.HttpConfig_cashmall(
    ).getBannerPool.param1 + '&' + Config.HttpConfig_cashmall(
    ).getBannerPool.param2 + '&' + Config.HttpConfig_cashmall(
    ).getBannerPool.param3
    data = {
        'callback': Config.HttpConfig_cashmall().getBannerPool.param1,
        'channelCode': Config.HttpConfig_cashmall().getBannerPool.param2
    }
    common_itemconfig_result = Common.revoke_get_request(url, data)
    Response.http_code_check(Config.HttpConfig_cashmall().getBannerPool.resp,
                             common_itemconfig_result)
    Verify.IsTrue(
        Common.get_http_code(url, data) == requests.codes.ok,
        Config.HttpConfig_cashmall().REQ_CODE)
    Logger.info('-------------------结束执行用例:【获取banner:正常】--------------------')
Exemplo n.º 12
0
def api_response_result_null(resp_dict):
    """
    @author: eason.sun
    @resp_dict: 待比对的字典集和
    @return: 对API返回的数据进行空值校验 True/False
    @summary: 比较字典内容是否为空,以下为接口返回数据:version/action/errCode/allRows/data
    """
    if not resp_dict.has_key(Config.ApiConfig().ResponseStruct.VersionKey):
        return False
    Logger.info("API接口数据中有版本信息")
    if not resp_dict.has_key(Config.ApiConfig().ResponseStruct.ActionKey):
        return False
    Logger.info("API接口数据中有Action信息")
    if not resp_dict.has_key(Config.ApiConfig().ResponseStruct.ErrorCodeKey):
        return False
    Logger.info("API接口数据中有错误码信息")
    if not resp_dict.has_key(Config.ApiConfig().ResponseStruct.AllRowsKey):
        return False
    Logger.info("API接口数据中有行数信息")
    if not resp_dict.has_key(Config.ApiConfig().ResponseStruct.DataKey):
        return False
    Logger.info("API接口数据中有数据信息")
    return True
Exemplo n.º 13
0
def test_get_Schedule():
    Logger.info('-------------------开始执行用例:【新版新闻页面摇一摇:正常】--------------------')
    url = Config.HttpConfig().getSchedule.url + '?' + Config.HttpConfig(
    ).getSchedule.param1 + '&' + Config.HttpConfig(
    ).getSchedule.param2 + '&' + Config.HttpConfig().getSchedule.param3
    data = {
        'callback': Config.HttpConfig().getSchedule.param1,
        'channelCode': Config.HttpConfig().getSchedule.param2
    }
    common_itemconfig_result = Common.revoke_get_request(url, data)
    Response.http_code_check(Config.HttpConfig().getSchedule.resp,
                             common_itemconfig_result)
    Verify.IsTrue(
        Common.get_http_code(url, data) == requests.codes.ok,
        Config.HttpConfig().REQ_CODE)
    Logger.info('-------------------结束执行用例:【新版新闻页面摇一摇:正常】--------------------')
Exemplo n.º 14
0
    def wait_until_complete(self, interval=500, timeout=10000):
        complete_js = 'return document.readyState == "complete"'

        start = 0
        while start < timeout:
            # 等待DOM状态为Complete且页面总耗时大于0
            state = self.driver.execute_script(complete_js) and self.timing(
                Config.WebConfig().Timing.TotalTime) > 0
            if state:
                time.sleep(interval / 1000.0)
                return True
            start += interval
            time.sleep(interval / 1000.0)
        return False
Exemplo n.º 15
0
def test_get_UserOrderList():
    Logger.info('-------------------开始执行用例:【获取全部订单:正常】--------------------')
    url = Config.HttpConfig_cashmall().URL + Config.HttpConfig_cashmall(
    ).getUserOrderList.path + '?' + Config.HttpConfig_cashmall(
    ).getUserOrderList.param1 + '&' + Config.HttpConfig_cashmall(
    ).getUserOrderList.param2 + '&' + Config.HttpConfig_cashmall(
    ).getUserOrderList.param3 + '&' + Config.HttpConfig_cashmall(
    ).getUserOrderList.param4
    data = {}
    common_itemconfig_result = Common.revoke_get_request(url, data)
    Response.http_code_check(
        Config.HttpConfig_cashmall().getUserOrderList.resp,
        common_itemconfig_result)
    Verify.IsTrue(
        Common.get_http_code(url, data) == requests.codes.ok,
        Config.HttpConfig_cashmall().REQ_CODE)
    Logger.info('-------------------结束执行用例:【获取全部订单:正常】--------------------')
Exemplo n.º 16
0
def test_get_ActTimer_topic():
    Logger.info(
        '-------------------开始执行用例:【获取猜广告游戏的配置 :正常】--------------------')
    url = Config.HttpConfig_ronghe3().URL + Config.HttpConfig_ronghe3(
    ).getActTimer.path + '?' + Config.HttpConfig_ronghe3(
    ).getActTimer.param1 + '&' + Config.HttpConfig_ronghe3(
    ).getActTimer.param2 + '&' + Config.HttpConfig_ronghe3(
    ).getActTimer.param3 + '&' + Config.HttpConfig_ronghe3().getActTimer.param4
    data = {}
    common_itemconfig_result = Common.revoke_get_request(url, data)
    Response.http_code_check(Config.HttpConfig_ronghe3().getActTimer.resp,
                             common_itemconfig_result)
    Verify.IsTrue(
        Common.get_http_code(url, data) == requests.codes.ok,
        Config.HttpConfig_ronghe3().REQ_CODE)
    Logger.info(
        '-------------------结束执行用例:【获取猜广告游戏的配置 :正常】--------------------')
Exemplo n.º 17
0
def send_email_with_attachments(content, header, file_paths,
                                host= Config.DefaultConfig().Email.Domain,
                                username= Config.DefaultConfig().Email.Sender,
                                password= Config.DefaultConfig().Email.Password, 
                                sender_addr= Config.DefaultConfig().Email.Sender,
                                rev_addr_lst=  Config.DefaultConfig().Email.Receiver ) : 
    """
    @author: eason.sun
    @content:邮件发送的主要内容
    @header:邮件发送的头部
    @file_paths:附件列表在本地的路径
    @username:邮件发件人账号
    @password:邮件发件人账号密码
    @sender_addr:邮件发送时,发件人显示地址
    @rev_addr_lst:收件人列表
    
    @return: None
    
    @summary: 用于发送邮件内容,内容带有多个附件
    """
    msg = MIMEMultipart()
    msg["Subject"] = Header(header, "utf-8")
    part = MIMEText(content, _subtype = "html", _charset = "utf-8")
    msg.attach(part)
    # 添加附件
    for file_path in file_paths:
        part = MIMEApplication(open(file_path,'rb').read())
        part["Content-Type"] = 'application/octet-stream;name=”%s”' % Header(os.path.basename(file_path), 'utf-8')
        part["Content-Disposition"] = 'attachment;filename= %s' % Header(os.path.basename(file_path), 'utf-8')
        msg.attach(part)
    try:
        s = smtplib.SMTP(host)
        s.login(username, password)
        s.sendmail(sender_addr, rev_addr_lst, msg.as_string())
    finally:
        s.close()
Exemplo n.º 18
0
def test_get_lottery_shake():
    Logger.info('-------------------开始执行用例:【摇动抽奖 :正常】--------------------')
    url = Config.HttpConfig_ronghe3().URL + Config.HttpConfig_ronghe3(
    ).lotteryShake.path + '?' + Config.HttpConfig_ronghe3(
    ).lotteryShake.param1 + '&' + Config.HttpConfig_ronghe3(
    ).lotteryShake.param2 + '&' + Config.HttpConfig_ronghe3(
    ).lotteryShake.param3
    data = {}
    common_itemconfig_result = Common.revoke_get_request(url, data)
    Response.http_code_check(Config.HttpConfig_ronghe3().lotteryShake.resp,
                             common_itemconfig_result)
    Verify.IsTrue(
        Common.get_http_code(url, data) == requests.codes.ok,
        Config.HttpConfig_ronghe3().REQ_CODE)
    Logger.info('-------------------结束执行用例:【摇动抽奖 :正常】--------------------')
Exemplo n.º 19
0
def test_get_usercardlist():
    Logger.info('-------------------开始执行用例:【获得用户卡券信息:正常】--------------------')
    url = Config.HttpConfig().getUserCardList.url + '?' + Config.HttpConfig(
    ).getUserCardList.param1 + '&' + Config.HttpConfig().getUserRedInfo.param2
    data = {
        'callback': Config.HttpConfig().getUserCardList.param1,
        'channelCode': Config.HttpConfig().getUserCardList.param2
    }
    common_itemconfig_result = Common.revoke_get_request(url, data)
    Response.http_code_check(Config.HttpConfig().getUserCardList.resp,
                             common_itemconfig_result)
    Verify.IsTrue(
        Common.get_http_code(url, data) == requests.codes.ok,
        Config.HttpConfig().REQ_CODE)
    Logger.info('-------------------结束执行用例:【获得用户卡券信息:正常】--------------------')
Exemplo n.º 20
0
def test_get_TipoffSetting():
    Logger.info('-------------------开始执行用例:【判断爆料设置 :正常】--------------------')
    url = Config.HttpConfig().getTipoffSetting.url + '?' + Config.HttpConfig(
    ).getTipoffSetting.param1 + '&' + Config.HttpConfig(
    ).getTipoffSetting.param2
    data = {
        'callback': Config.HttpConfig().getTipoffSetting.param1,
        'channelCode': Config.HttpConfig().getTipoffSetting.param2
    }
    common_itemconfig_result = Common.revoke_get_request(url, data)
    Response.http_code_check(Config.HttpConfig().getTipoffSetting.resp,
                             common_itemconfig_result)
    Verify.IsTrue(
        Common.get_http_code(url, data) == requests.codes.ok,
        Config.HttpConfig().REQ_CODE)
    Logger.info('-------------------结束执行用例:【判断爆料设置 :正常】--------------------')
Exemplo n.º 21
0
def test_get_List3_topic():
    Logger.info('-------------------开始执行用例:【获取节目单信息 :正常】--------------------')
    url = Config.HttpConfig_ronghe3().URLHTTP + Config.HttpConfig_ronghe3(
    ).getList.path + '?' + Config.HttpConfig_ronghe3(
    ).getList.param1 + '&' + Config.HttpConfig_ronghe3().getList.param2
    data = {}
    common_itemconfig_result = Common.revoke_get_request(url, data)
    Response.http_code_check(Config.HttpConfig_ronghe3().getList.resp,
                             common_itemconfig_result)
    Verify.IsTrue(
        Common.get_http_code(url, data) == requests.codes.ok,
        Config.HttpConfig_ronghe3().REQ_CODE)
    Logger.info('-------------------结束执行用例:【获取节目单信息 :正常】--------------------')
Exemplo n.º 22
0
def test_get_AudiNewsSize():
    Logger.info(
        '-------------------开始执行用例:【每隔十秒拉取最新审核新闻的长度:正常】--------------------')
    url = Config.HttpConfig().getAuditNewsSize.url + '?' + Config.HttpConfig(
    ).getAuditNewsSize.param1 + '&' + Config.HttpConfig(
    ).getAuditNewsSize.param2
    data = {
        'callback': Config.HttpConfig().getAuditNewsSize.param1,
        'channelCode': Config.HttpConfig().getAuditNewsSize.param2
    }
    common_itemconfig_result = Common.revoke_get_request(url, data)
    Response.http_code_check(Config.HttpConfig().getAuditNewsSize.resp,
                             common_itemconfig_result)
    Verify.IsTrue(
        Common.get_http_code(url, data) == requests.codes.ok,
        Config.HttpConfig().REQ_CODE)
    Logger.info(
        '-------------------结束执行用例:【每隔十秒拉取最新审核新闻的长度:正常】--------------------')
Exemplo n.º 23
0
def test_get_ProgramTopicListByPage_topic():
    Logger.info(
        '-------------------开始执行用例:【获取某热门节目下的话题 :正常】--------------------')
    url = Config.HttpConfig_ronghe3().URL + Config.HttpConfig_ronghe3(
    ).getProgramTopicListByPage.path + '?' + Config.HttpConfig_ronghe3(
    ).getProgramTopicListByPage.param1 + '&' + Config.HttpConfig_ronghe3(
    ).getProgramTopicListByPage.param2 + '&' + Config.HttpConfig_ronghe3(
    ).getProgramTopicListByPage.param3
    data = {}
    common_itemconfig_result = Common.revoke_get_request(url, data)
    Response.http_code_check(
        Config.HttpConfig_ronghe3().getProgramTopicListByPage.resp,
        common_itemconfig_result)
    Verify.IsTrue(
        Common.get_http_code(url, data) == requests.codes.ok,
        Config.HttpConfig_ronghe3().REQ_CODE)
    Logger.info(
        '-------------------结束执行用例:【获取某热门节目下的话题 :正常】--------------------')
Exemplo n.º 24
0
def test_get_ConfirmOrderInfo_cash():
    Logger.info('-------------------开始执行用例:【获取确认订单信息:正常】--------------------')
    url = Config.HttpConfig_cashmall().URL + Config.HttpConfig_cashmall(
    ).getConfirmOrderInfo.path + '?' + Config.HttpConfig_cashmall(
    ).getConfirmOrderInfo.param1 + '&' + Config.HttpConfig_cashmall(
    ).getConfirmOrderInfo.param2
    data = {}
    common_itemconfig_result = Common.revoke_get_request(url, data)
    Response.http_code_check(
        Config.HttpConfig_cashmall().getConfirmOrderInfo.resp,
        common_itemconfig_result)
    Verify.IsTrue(
        Common.get_http_code(url, data) == requests.codes.ok,
        Config.HttpConfig_cashmall().REQ_CODE)
    Logger.info('-------------------结束执行用例:【获取确认订单信息:正常】--------------------')
Exemplo n.º 25
0
def test_get_ActMaterial_shake():
    Logger.info(
        '-------------------开始执行用例:【获取摇动时的广告图片 :正常】--------------------')
    url = Config.HttpConfig_ronghe3().URL + Config.HttpConfig_ronghe3(
    ).getActMaterial.path + '?' + Config.HttpConfig_ronghe3(
    ).getActMaterial.param1 + '&' + Config.HttpConfig_ronghe3(
    ).getActMaterial.param2
    data = {}
    common_itemconfig_result = Common.revoke_get_request(url, data)
    Response.http_code_check(Config.HttpConfig_ronghe3().getActMaterial.resp,
                             common_itemconfig_result)
    Verify.IsTrue(
        Common.get_http_code(url, data) == requests.codes.ok,
        Config.HttpConfig_ronghe3().REQ_CODE)
    Logger.info(
        '-------------------结束执行用例:【获取摇动时的广告图片 :正常】--------------------')
Exemplo n.º 26
0
def test_get_ChannelConfig_shake():
    Logger.info(
        '-------------------开始执行用例:【获取频道信息(进入按钮图片enterBtnImg、互动背景图actBgImg、摇宝图片yaoBaoImg) :正常】--------------------'
    )
    url = Config.HttpConfig_ronghe3().URL + Config.HttpConfig_ronghe3(
    ).getChannelConfigShake.path + '?' + Config.HttpConfig_ronghe3(
    ).getChannelConfigShake.param1 + '&' + Config.HttpConfig_ronghe3(
    ).getChannelConfigShake.param2 + '&' + Config.HttpConfig_ronghe3(
    ).getChannelConfigShake.param3
    data = {}
    common_itemconfig_result = Common.revoke_get_request(url, data)
    Response.http_code_check(
        Config.HttpConfig_ronghe3().getChannelConfigShake.resp,
        common_itemconfig_result)
    Verify.IsTrue(
        Common.get_http_code(url, data) == requests.codes.ok,
        Config.HttpConfig_ronghe3().REQ_CODE)
    Logger.info(
        '-------------------结束执行用例:【获取频道信息(进入按钮图片enterBtnImg、互动背景图actBgImg、摇宝图片yaoBaoImg) :正常】--------------------'
    )
Exemplo n.º 27
0
def test_get_ChannelConfigByType_topic():
    Logger.info(
        '-------------------开始执行用例:【显示设置(是否显示理财、电影、精彩推荐等):正常】--------------------'
    )
    url = Config.HttpConfig_ronghe3().URL + Config.HttpConfig_ronghe3(
    ).getChannelConfigByType.path + '?' + Config.HttpConfig_ronghe3(
    ).getChannelConfigByType.param1 + '&' + Config.HttpConfig_ronghe3(
    ).getChannelConfigByType.param2 + '&' + Config.HttpConfig_ronghe3(
    ).getChannelConfigByType.param3
    data = {}
    common_itemconfig_result = Common.revoke_get_request(url, data)
    Response.http_code_check(
        Config.HttpConfig_ronghe3().getChannelConfigByType.resp,
        common_itemconfig_result)
    Verify.IsTrue(
        Common.get_http_code(url, data) == requests.codes.ok,
        Config.HttpConfig_ronghe3().REQ_CODE)
    Logger.info(
        '-------------------结束执行用例:【显示设置(是否显示理财、电影、精彩推荐等):正常】--------------------'
    )
Exemplo n.º 28
0
def test_get_ProgramStatisticsNum_topic():
    Logger.info(
        '-------------------开始执行用例:【获取热门电视下的话题数量和评论数量 :正常】--------------------'
    )
    url = Config.HttpConfig_ronghe3().URL + Config.HttpConfig_ronghe3(
    ).getProgramStatisticsNum.path + '?' + Config.HttpConfig_ronghe3(
    ).getProgramStatisticsNum.param1 + '&' + Config.HttpConfig_ronghe3(
    ).getProgramStatisticsNum.param2
    data = {}
    common_itemconfig_result = Common.revoke_get_request(url, data)
    Response.http_code_check(
        Config.HttpConfig_ronghe3().getProgramStatisticsNum.resp,
        common_itemconfig_result)
    Verify.IsTrue(
        Common.get_http_code(url, data) == requests.codes.ok,
        Config.HttpConfig_ronghe3().REQ_CODE)
    Logger.info(
        '-------------------结束执行用例:【获取热门电视下的话题数量和评论数量 :正常】--------------------'
    )
Exemplo n.º 29
0
def test_get_saveTipoff():
    Logger.info('-------------------开始执行用例:【提交爆料:正常】--------------------')
    url = Config.HttpConfig().saveTipoff.url + '?' + Config.HttpConfig(
    ).saveTipoff.param1 + '&' + Config.HttpConfig(
    ).saveTipoff.param2 + '&' + Config.HttpConfig(
    ).saveTipoff.param3 + '&' + Config.HttpConfig(
    ).saveTipoff.param4 + '&' + Config.HttpConfig(
    ).saveTipoff.param5 + '&' + Config.HttpConfig(
    ).saveTipoff.param6 + '&' + Config.HttpConfig(
    ).saveTipoff.param7 + '&' + Config.HttpConfig(
    ).saveTipoff.param8 + '&' + Config.HttpConfig().saveTipoff.param9
    data = {
        'callback': Config.HttpConfig().saveTipoff.param1,
        'channelCode': Config.HttpConfig().saveTipoff.param2
    }
    common_itemconfig_result = Common.revoke_get_request(url, data)
    Response.http_code_check(Config.HttpConfig().saveTipoff.resp,
                             common_itemconfig_result)
    Verify.IsTrue(
        Common.get_http_code(url, data) == requests.codes.ok,
        Config.HttpConfig().REQ_CODE)
    Logger.info('-------------------结束执行用例:【提交爆料:正常】--------------------')
Exemplo n.º 30
0
def nose_run(parser):
    Config.nose_set("verbosity", parser.verbosity)
    Config.nose_set("logging-config", Dir.log_config_path())
    # 通过关键字筛选出来的用例列表
    tests = FileHelper.tests_filter_from_dir(Dir.testcases_root_dir(),
                                             parser.select, parser.priority)
    Config.nose_set("where", Dir.testcases_root_dir())
    if len(tests):
        for i in xrange(parser.loop):
            # 生成的报表每个名称都不一样,以时间为区分
            nosexml = Dir.nose_result_path(
            ) + "wy_autotest_" + Datetime.now_str() + ".xml"
            Config.nose_set("tests", ",".join(tests))
            Config.nose_set("xunit-file", nosexml)
            Logger.info("正在第{0}/{1}次进行Nose测试".format(i + 1, parser.loop))
            Logger.info("执行Nose命令:{0}".format(Config.nose_cmd()))
            # 切换当前路径为工程根目录
            os.chdir(Dir.project_root_dir())
            os.system("nosetests")
            #发送邮件
            result_summary = Result.test_result_summary(nosexml)
            result_detail = Result.test_result_detail(nosexml)
            rev_addr_lst = [
                "*****@*****.**", "*****@*****.**",
                "*****@*****.**"
            ]
            Mail.send_email_with_attachment(
                result_summary + result_detail,
                Config.DefaultConfig().Email.Subject, nosexml, rev_addr_lst)
            Logger.info("完成第{0}/{1}次进行Nose测试".format(i + 1, parser.loop))
    else:
        Logger.info("抱歉,没有符合条件的执行测试用例!")