Beispiel #1
0
 def dbexist(self, phone):
     # 实例话ExecuteMysql类
     emysql = ExecuteMysql()
     num = emysql.find_count("select * from member where MobilePhone=%s" %
                             phone)
     if num:
         return 1
     else:
         return 0
Beispiel #2
0
 def sqlassertion(self):
     # 实例话执行用例的类
     self.executemysql = ExecuteMysql()
     # 取excle里的手机号码
     sqlresult = self.executemysql.find_one(
         "select * from member where MobilePhone = %s;" % self.phone()[0])
     print(sqlresult)
     if sqlresult:
         self.wb.write_date(int(self.phone()[1] + 1), 11, "数据库插入数据成功")
     else:
         self.wb.write_date(int(self.phone()[1] + 1), 11, "数据库插入数据失败")
Beispiel #3
0
class SqlAssertion(object):
    wb = ReadExcel(os.path.join(DATE_DIR, file_name), "register")
    cases = wb.read_line_date()

    def phone(self):
        for case in self.cases:
            request_data = eval(case.request_data)
            row = case.case_id
            print(row)
        # 将参数值里的手机号码提取出来给phone
        phone = request_data.get("mobilephone")
        print(phone)
        return phone, row

    def sqlassertion(self):
        # 实例话执行用例的类
        self.executemysql = ExecuteMysql()
        # 取excle里的手机号码
        sqlresult = self.executemysql.find_one(
            "select * from member where MobilePhone = %s;" % self.phone()[0])
        print(sqlresult)
        if sqlresult:
            self.wb.write_date(int(self.phone()[1] + 1), 11, "数据库插入数据成功")
        else:
            self.wb.write_date(int(self.phone()[1] + 1), 11, "数据库插入数据失败")
 def setUpClass(cls):
     my_log.info(
         "============================== 准备开始执行取现接口的测试 =============================="
     )
     cls.request = HTTPRequest2()
     cls.db = ExecuteMysql()
Beispiel #5
0
 def setUpClass(cls) -> None:
     output_log.info(
         "============================== 开始执行新增用户接口测试 =============================="
     )
     cls.request = HTTPRequest()
     cls.db = ExecuteMysql()
Beispiel #6
0
E-mail:[email protected]

=================================


"""

import re
from common.config import conf
import random
from common.execute_mysql import ExecuteMysql

# 匹配两个#中间的任意字符,至少一次,关闭贪婪
p = r"#(.+?)#"
db = ExecuteMysql()


class ConText(object):
    pass


# def read(data):
#     setattr(ConText, "key", data)

# 接收号段,然后随机生成8位0-9的数字,添加在号段后面,组合成为指定号段的随机号码
def rand_phone(segment):
    phone = str(segment)
    for i in range(8):
        phone_end = random.randint(0, 9)
        phone += str(phone_end)