예제 #1
0
def get_data():
    data = ReadJson("obtain.json").read_json()
    list1 = []
    list1.append((data.get("url"),
                  data.get("token"),
                  data.get("status_code")))
    return list1
예제 #2
0
def get_data():
    datas = ReadJson("login_more.json").read_json()
    arrs = []
    for data in datas.values():
        arrs.append((data.get("url"), data.get("mobile"), data.get("code"),
                     data.get("expect_resule"), data.get("status_code")))
        print(arrs)
    return arrs
예제 #3
0
def get_data_cancle():
    data = ReadJson("article_cancle.json").read_json()
    arrs = []
    arrs.append((data.get("url"),
                 data.get("headers"),
                 data.get("status_code")
                 ))
    return (arrs)
예제 #4
0
def get_data_cancel():
    data = ReadJson("article_cancel.json").read_json()
    # print(data)
    arrs = []
    arrs.append(
        (data.get("url"), data.get("headers"), data.get("status_code")))
    # print(arrs)
    return arrs
예제 #5
0
def get_data_cancel():
    data = ReadJson("article_cancel.json").read_json()
    # 新建空列表,添加读取json数据
    arrs = []
    arrs.append((data.get("url"),
                 data.get("headers"),
                 data.get("status_code")))
    return arrs
예제 #6
0
def get_qx_data():
    data = ReadJson("collect_more1.json").read_json()
    airs = [(data.get("path"),
             data.get("data"),
             data.get("msg"),
             data.get("status_code")
             )]
    # 使用遍历获取所有value
    return airs
예제 #7
0
def get_data():
    datas = ReadJson().read_json("addCon_more.json")
    # 新建空列表,添加读取json数据
    arrs = []
    # 使用遍历
    for data in datas.values():
        arrs.append((data.get("url"), data.get("name"), data.get("value"),
                     data.get("expect_result"), data.get("status_code")))
    return arrs
예제 #8
0
def get_data():
    datas = ReadJson("token_more.json").read_json()
    # 新建空列表,添加读取json数据
    list1 = []
    for data in datas.values():
        list1.append(
            (data.get("url"), data.get("grant_type"), data.get("appid"),
             data.get("secret"), data.get("expires_in")))
    return list1
예제 #9
0
def get_data():
    datas = ReadJson("login_more.json").read_json()
    # 新建空列表,读取json数据
    arrs = []
    # 使用遍历获取所有的value值
    for data in datas.values():
        arrs.append((data.get("url"), data.get("mobile"), data.get("code"),
                     data.get("expect_result"), data.get("status_code")))
    return arrs
예제 #10
0
def get_data_cancel():
    data = ReadJson("article_cancel.json").read_json()
    arrs = []
    # append本身添加的就是[],而我们需要的是[()],所以里面要加上(),否则就把所有内容都添加到一个列表里了
    arrs.append((
        data.get("url"),  # data["url"]和get方式的区别是前者如果获取错误会报异常,后者则为空
        data.get("headers"),
        data.get("status_code")))
    return arrs
예제 #11
0
def get_data_cancel():
    data = ReadJson("article_cancel.json").read_json()
    arrs = []
    arrs.append((
        data.get('url'),
        data.get('headers'),
        data.get('status_code')
    ))
    return arrs
예제 #12
0
def get_data():  #处理返回的json中字典内容,达到我们要求的[()]格式
    datas = ReadJson("login_more.json").read_json()
    arrs = []
    for data in datas.values():  # 遍历获取所有value
        # append本身添加的就是[],而我们需要的是[()],所以里面要加上(),否则就把所有内容都添加到一个列表里了
        arrs.append((
            data.get("url"),  # data["url"]和get方式的区别是前者如果获取错误会报异常,后者则为空
            data.get("mobile"),
            data.get("code"),
            data.get("except_result"),
            data.get("status_code")))
    return arrs
예제 #13
0
def get_data():
    datas = ReadJson("login_more.json").read_json()
    # 新建空列表,添加读取json数据
    arrs = []
    # 遍历获取所有value
    for data in datas.values():
        arrs.append((data.get("jumpurl"),
                     data.get("step"),
                     data.get("pwuser"),
                     data.get("pwpwd"),
                     data.get("lgt")))
    return arrs
예제 #14
0
 def run_case(self):
     rows = HandExcel().get_rows()
     for i in range(rows-1):
         deepen_data = None
         data = HandExcel().get_rows_value(i+2)
         body = data[5]
         body_json = json.loads(body)
         # 根据名称查询列号,然后拿到数据
         is_run = data[HandExcel().get_cells_num("是否执行")]
         if is_run == 'YES':
             is_depend = data[10]
             # 前置处理
             if is_depend is None:
                 pass
             else:
                 deepen_key = data[12]
                 deepen_data = get_data(is_depend)
                 body_json[deepen_key] = deepen_data
             excepect_method = data[6]  # 预期结果获取方式
             method = data[3]
             url = data[2]
             headers = data[4]
             headers_json = json.loads(headers)
             res = BaseRequest().base_request(method, url, headers_json, body_json)
             # 讲结果写入excel
             HandExcel().excel_write_data(i + 2, 12, json.dumps(res, ensure_ascii=False))
             print(res)
             code = ReadJson().key_tovalue(res, "err_code")
             msg = ReadJson().key_tovalue(res, "err_msg")
             # 验证方式的区分
             if excepect_method == 'message+errorcode':
                 config_msg = handle_result(url, code)
                 if msg == config_msg:
                     HandExcel().excel_write_data(i+2, 9, "成功")
                     print("成功了")
                 else:
                     HandExcel().excel_write_data(i+2, 10, json.dumps(res, ensure_ascii=False))
                     print("失败了")
             if excepect_method == 'errorcode':
                 excepect_code = data[7]
                 if code == excepect_code:
                     HandExcel().excel_write_data(i+2, 9, "成功")
                     print("成功了")
                 else:
                     HandExcel().excel_write_data(i+2, 10, json.dumps(res, ensure_ascii=False))
                     print("失败了")
             if excepect_method == 'json':
                 boo = handle_result_json(res, url, code)
                 if boo:
                     print("成功了")
                 else:
                     print("失败了")
예제 #15
0
def get_data():
    arr = list()
    data = ReadJson.read_json("app_article.json")
    for a in data.values():
        arr.append((a.get("channel"), a.get("title")))
    print(arr)
    return arr
예제 #16
0
class Test_glq(unittest.TestCase):
    data = ReadJson.read_json('../test_element/element.json')["txljq"]
    driver = MyWebDriver.start()

    @classmethod
    def setUpClass(cls):
        Login.login()
        MyWebDriver.wait_element_present(cls.data["page"]).click()
        MyWebDriver.wait_element_present(cls.data["exploitpeople"]).click()
        MyWebDriver.wait_element_present(cls.data["txljq"]).click()

    def setUp(self):
        MyWebDriver.wait_element_present(self.data["page"]).click()

    @parameterized.expand([('describe', '2')])
    def test_1_add_ljq(self, describe, text):
        MyWebDriver.wait_element_present(self.data["addljq"]).click()
        MyWebDriver.wait_element_present(self.data["tcp"]).click()
        UpperTools.input(self.data["describe"], describe)
        MyWebDriver.wait_element_present(self.data["select"]).click()
        MyWebDriver.wait_element_present(
            '/html/body/div[3]/div[2]/div/div/div[2]/form/div[2]/div[1]/div/div/div[2]/ul[2]/li[%s]'
            % text).click()
        self.assertEqual(1, 1)

    def tearDown(self):
        pass

    @classmethod
    def tearDownClass(cls):
        MyWebDriver.start().close()
예제 #17
0
def get_data():  # 处理返回的json中字典内容,达到我们要求的[()]格式
    datas = ReadJson("test_login/login_more.json").read_json()
    arrs = []
    print("xxx", datas)
    for i in datas.values():  # 遍历获取所有value,取出'test'的内容
        print("***", len(i), i)

        for data in i:  # 遍历获取list所有值
            # append本身添加的就是[],而我们需要的是[()],所以里面要加上(),否则就把所有内容都添加到一个列表里了
            print("yyy", data)
            arrs.append((
                data.get("case"),  # data["url"]和get方式的区别是前者如果获取错误会报异常,后者则为空
                data.get("headers"),
                data.get("payload"),
                data.get("expected")))
    return arrs
예제 #18
0
def read_json(url, status):
    data = ReadJson().get_value(url, "code_message.json")
    for i in data:
        message = i.get(status)
        # 如果message不等于空则返回message
        if message:
            return message
    return None
예제 #19
0
def handle_result(url, code):
    data = ReadJson().get_value(url, "code_message.json")
    for i in data:
        message = i.get(str(code))
        # 如果message不等于空则返回message
        if message:
            return message
    return None
예제 #20
0
def get_data():
    datas = ReadJson("login_more.json").read_json()
    # print(datas)
    arrs = []
    #使用遍历获取所有的value
    for datas in datas.values():
        arrs.append((datas.get("url"), datas.get("mobile"), datas.get("code"),
                     datas.get("expect_result"), datas.get("status_code")))
    # print(arrs)
    return arrs
예제 #21
0
def get_data():
    data = ReadJson("login.json").read_json()
    # 新建空列表,添加读取json数据
    arrs = []
    arrs.append((data.get("url"), data.get("mobile"), data.get("code"),
                 data.get("expect_result"), data.get("status_code")))
    return arrs
예제 #22
0
def get_data():
    data = ReadJson("login.json").read_json()
    # 新建空列表,添加读取json数据
    arrs = []
    arrs.append((data.get("jumpurl"), data.get("step"), data.get("pwuser"),
                 data.get("pwpwd"), data.get("lgt")))
    return arrs
예제 #23
0
def get_data():
    data = ReadJson("login.json").read_json()
    arr = []
    arr.append((data.get("url"), data.get("mobile"), data.get("code"),
                data.get("expect_resule"), data.get("status_code")))
    # print(arr)
    return arr
예제 #24
0
def get_data_add():
    data = ReadJson("article_add.json").read_json()
    # 新建空列表,添加读取json数据
    # print("shuju", data)
    arrs = []
    arrs.append((data.get("url"), data.get("headers"), data.get("data"),
                 data.get("expect_result"), data.get("status_code")))
    return arrs
예제 #25
0
def get_data():
    data = ReadJson("login.json").read_json()
    # data是字典格式,粗腰创建空列表存储数据
    arrs = []
    arrs.append((data.get("url"), data.get("mobile"), data.get("code"),
                 data.get("expect_result"), data.get("status_code")))
    # print(arrs)
    return arrs
예제 #26
0
class Login:

    driver = MyWebDriver.start()
    data = ReadJson.read_json('../test_element/element.json')

    @classmethod
    def login(cls):
        data = cls.data['login']
        UpperTools.input(data['username'], 'test004')
        UpperTools.input(data['password'], 'qw123456')
        MyWebDriver.wait_element_present(data['button']).click()
예제 #27
0
def get_data():
    data = ReadJson().read_json("addCon.json")
    # 新建空列表,添加读取json数据
    arrs = []
    arrs.append((data.get("url"),
                 data.get("name"),
                 data.get("value"),
                 data.get("expect_result"),
                 data.get("status_code")))
    return arrs
예제 #28
0
def get_data():
    data = ReadJson('channels.json').read_json()
    arrs = []
    arrs.append(
        (data.get('url'), data.get('headers'), data.get('expect_result'),
         data.get('status_code')))
    return arrs
예제 #29
0
def get_data():
    data = ReadJson("login.json").read_json()
    #新建空列表,存放读取json数据
    arrs = []
    arrs.append((data.get('url'), data.get('name'), data.get('password'),
                 data.get('expect_result')))
    return arrs
예제 #30
0
def get_data():
    data = ReadJson("channel.json").read_json()
    arrs = []
    arrs.append(
        (data.get("url"), data.get("headers"), data.get("expect_result"),
         data.get("status_code")))
    return arrs