예제 #1
0
 def creadeCollectionpro_weibao(self):
     '''创建募集尾包产品'''
     tool = webrequests()
     ceradeurl = tool.confige_get('craderurl', 'url')
     creadebody = tool.confige_items('creaderbody3')
     tool.CreatProduct(ceradeurl, creadebody)
     time.sleep(6)
예제 #2
0
 def creadeNonCollectionpro(self):
     '''创建非募集产品'''
     tool = webrequests()
     ceradeurl = tool.confige_get('craderurl', 'url', url='')
     creadebody = tool.confige_items('creaderbody')
     resut = tool.CreatProduct(ceradeurl, creadebody)
     print(resut)
     time.sleep(6)
예제 #3
0
 def establish(self, sql):
     '''成标'''
     tool = webrequests()
     establishUrl = tool.confige_get('establishUrl', 'url', url='')
     prductID = str(tool.get_identifying_code(sql, "id", "num_pro"))
     tool.config_write('establishPostDate', 'id', prductID)  # 写入产品id参数
     time.sleep(3)
     establishData = tool.confige_items('establishPostDate')
     tool.examine(establishUrl, establishData)
     time.sleep(5)
예제 #4
0
 def examine(self, sql):
     '''审核'''
     tool = webrequests()
     examineUrl = tool.confige_get('examinUrl', 'url', url='')
     prductID = str(tool.get_identifying_code(sql, "id", "num_pro"))
     tool.config_write('examinPostDate', 'product_id',
                       prductID)  # 写入数据库中的product_id
     time.sleep(3)
     examineData = tool.confige_items('examinPostDate')
     print(examineData)
     tool.examine(examineUrl, examineData)
     time.sleep(5)
예제 #5
0
 def test_weather(self):
     '''查询天气'''
     case_name = '查询天气'
     log1.info("执行测试用例:%s" % case_name)
     try:
         weather = webrequests()
         url = weather.confige_get('test','url',url='')
         payloda = {'city':'上海'}
         status_code,response_json =weather.get(url,params=payloda)
         message = weather.getdict(response_json,'message')
         test1 = self.assertEqual(status_code,200)
         test2 = self.assertEqual(message,'Success !')
         if test1 == None and test2 ==None:
             log1.info("测试通过")
     except BaseException as f :
         log1.error("测试用例执行出错: %s" % case_name,exc_info=1)
         raise
예제 #6
0
    def setUpClass(self):
        # desired_caps = {'platformName': 'Android', # 平台名称
        #                 # 'platformVersion': '6.0.1',  # 系统版本号
        #                 #'deviceName': '83c4caa7',  # 设备名称。如果是真机,在'设置->关于手机->设备名称'里查看
        #                 #'platformVersion': '4.4.2',  # 系统版本号
        #                 #'deviceName': '127.0.0.1:62001',  #nox_adb.exe connect 127.0.0.1:62001 设备名称。如果是真机,在'设置->关于手机->设备名称'里查看
        #                 # 'platformVersion': '4.4.4',  # 系统版本号
        #                 # 'deviceName': '0acb291f',  # 设备名称。如果是真机,在'设置->关于手机->设备名称'里查看
        #                 'platformVersion': '5.1.1',
        #                 'deviceName': 'Y9K0215204005433',
        #                 'appPackage': 'com.shuniuyun.tjs',  # apk的包名
        #                 'appActivity': 'com.shuniuyun.tjs.ui.main.activity.StartActivity',  # activity 名称
        #                 'automationName' : 'Uiautomator2',
        #                 'unicodeKeyboard': 'True',#使用unicode编码方式发送字符串
        #                 'resetKeyboard': 'True'#将键盘隐藏起来 http://127.0.0.1:4723/wd/hub
        #                 }
        webr = webrequests()
        name = 'find.exe'
        count = 2
        tim = Timer(7.0, webr.kill_pids,
                    (name, count))  # 启动程序7s后 查找进程find.exe并删除两次
        tim.start()  #启动
        desired_caps = {
            "platformName": "Android",
            "platformVersion": "5.1.1",  #5.1.1
            "deviceName": "127.0.0.1:21503",  #Y9K0215204005433
            "appPackage": "com.shuniuyun.tjs",
            "appActivity": "com.shuniuyun.tjs.ui.main.activity.StartActivity",
            "unicodeKeyboard": True,
            "resetKeyboard": True,
            "automationName": "Uiautomator2",
            "chromeOptions": {
                "androidProcess": "com.shuniuyun.tjs"
            }
        }

        self.driver = webdriver.Remote("http://localhost:4723/wd/hub",
                                       desired_caps)  # 连接Appium
        time.sleep(5)
        TouchAction(self.driver).press(x=625, y=787).move_to(
            x=80, y=787).release().perform()  # 滑动启始页面
        time.sleep(3)
        self.driver.find_element_by_id(
            "com.shuniuyun.tjs:id/btn_start").click()
예제 #7
0
#!/usr/bin/python3

import smtplib
from email.mime.text import MIMEText
from email.utils import formataddr
from email.mime.multipart import MIMEMultipart
import getcwd
import os
from Logs.log import log1
from Common.Base_test import webrequests
import time

rq = time.strftime('%Y%m%d', time.localtime(time.time()))  #获取本地时间 转换成日期
my_mail = webrequests()
sender = my_mail.confige_get('sender', 'email')  # 发件人邮箱账号
password = my_mail.confige_get('sender', 'password')  # 发件人邮箱密码
usernmae = my_mail.confige_get('sender', 'username')  #发件人姓名
users = my_mail.confige_options('addressed')  #收件人
addressed_eamils = my_mail.get_addkey(users)  #收件人邮箱

path = getcwd.get_cwd()
file = os.path.join(path, 'report/钱包接口自动化测试报告.html')


def mail():
    try:
        # 创建一个带附件的实例
        message = MIMEMultipart()
        message['From'] = formataddr([usernmae,
                                      sender])  # 括号里的对应发件人邮箱昵称、发件人邮箱账号
        log1.info('发件人姓名:%s' % usernmae)
예제 #8
0
 #     "title": "王企鹅群翁群无124",
 #     "type": "vedio",
 #     "cook_type": "boil",
 #     "month_type": "",
 #     "function_type": "calcium",
 #     "display_order": "0",
 #     "read": "0",
 #     "image": "https://aiyomi.oss-cn-hangzhou.aliyuncs.com/aiyomi/20190820175157145.jpg",
 #     "remark": "文青翁群翁群翁群翁群翁",
 #     "media_url": "https://s1.aiyomi.cn/video/20190820175304178.m3u8",
 #     "content": "6K+36Zeu5LyB6bmF57+B576k57+B576k5LqM576k5LqMcQ=="
 # }
 url2 = "http://admin.aiyomi.com/server/section/edit_section.html"
 url1 = "http://admin.aiyomi.com/server/section/get_section_by_course_age.html"
 subtitle = ["起床音乐", "亲子对话", "经典名曲", "亲子游戏", "晚安故事"]
 too = webrequests()  #3333
 for j in range(193, 200):  #设定新建课程天数区间
     too.config_write('course_age', "age_match", str(j))
     too.config_write('CoreCourse', "age_match", str(j))
     course_age = too.confige_items('course_age')
     edit_section = mytest(url1, course_age)
     edit_section.session_post()
     for i in subtitle:
         if i == "起床音乐":
             too.config_write('CoreCourse', "subtitle", i)
             too.config_write('CoreCourse', "parent_id", "0")
             # display_order入参 对应列表的下标subtitle.index(i)
             too.config_write('CoreCourse', "display_order",
                              str(subtitle.index(i)))
             file_coure2 = too.confige_items('CoreCourse')
             edit_section = mytest(url2, file_coure2)
예제 #9
0
 def shiliwebrequests(self):
     tool = webrequests()
     return tool
예제 #10
0
from Common.Base_test import webrequests
from Logs.log import log1

section = 'login'
username = '******'
password = '******'

s = webrequests()

s.config_write(section)
log1.info("写入section:%s" % section)
s.config_write(section, 'username', username)
log1.info("写入%s下的用户名是:%s" % (section, username))
s.config_write(section, 'password', password)
log1.info("写入%s下的密码是:%s" % (section, password))

url = s.confige_get('test', 'url', url='test/test1')
get_username = s.confige_get(section, 'username')
log1.info("读取的用户名:%s" % get_username)
get_password = s.confige_get(section, 'password')
log1.info("读取的密码:%s" % get_password)

s.config_delete(
    section,
    'usrename',
)
log1.info("删除%s下的username" % section)
s.config_delete(section, 'password')
log1.info("删除%s下的password" % section)
s.config_delete(section)
log1.info("删除%s" % section)