Esempio n. 1
0
    def inputtapinputtext(self,activebrowser,newaddid):
        timestr = GetTimeStr().getTimeStr()
        inputtext_list = []
        from testdatas.models import InputTapInputText
        inputtapinputtexts = InputTapInputText.objects.filter(newaddandcheck_id=int(newaddid))
        if str(inputtapinputtexts) != "<QuerySet []>":
            activebrowser.outPutMyLog(u"找到依赖数据")
            for inputtapinputtext in inputtapinputtexts:
                if inputtapinputtext.is_auto_input:
                    if inputtapinputtext.auto_input_type == '1' :   #自动生成0~9数字字符串
                        inputtextwithtimestr = automakestring.getDigits(inputtapinputtext.auto_input_long)
                    elif inputtapinputtext.auto_input_type == '2' :  #小写字母
                        inputtextwithtimestr = automakestring.getAsciiLowercase(inputtapinputtext.auto_input_long)
                    elif inputtapinputtext.auto_input_type == '3' :  #字母(大写)
                        inputtextwithtimestr = automakestring.getAsciiUppercase(inputtapinputtext.auto_input_long)
                    elif inputtapinputtext.auto_input_type == '4' :  #特殊符号
                        inputtextwithtimestr = automakestring.getSymbols(inputtapinputtext.auto_input_long)
                    elif inputtapinputtext.auto_input_type == '5' :  #数字和字母(小写)
                        inputtextwithtimestr = automakestring.getLowercaseAndDigits(inputtapinputtext.auto_input_long)
                    elif inputtapinputtext.auto_input_type == '6' :  #数字和字母(大写)
                        inputtextwithtimestr = automakestring.getUppercaseAndDigits(inputtapinputtext.auto_input_long)
                    elif inputtapinputtext.auto_input_type == '7' :  #字母(大小写)
                        inputtextwithtimestr = automakestring.getAsciiLetters(inputtapinputtext.auto_input_long)
                    elif inputtapinputtext.auto_input_type == '8' :  #数字和字母(大小写)
                        inputtextwithtimestr = automakestring.getLettersAndDigits(inputtapinputtext.auto_input_long)
                    elif inputtapinputtext.auto_input_type == '9' :  #数字和字母和特殊符号
                        inputtextwithtimestr = automakestring.getLetterAndDigitsAndSymbols(inputtapinputtext.auto_input_long)
                    elif inputtapinputtext.auto_input_type == '10' :  #数字和字母和特殊符号和空白字符
                        inputtextwithtimestr = automakestring.getLetterAndDigitsAndSymbolsAndWhitespace(inputtapinputtext.auto_input_long)
                    elif inputtapinputtext.auto_input_type == '11' : #汉字
                        inputtextwithtimestr = automakestring.getUnicodeZh(inputtapinputtext.auto_input_long)
                    elif inputtapinputtext.auto_input_type == '12':  #手机号
                        inputtextwithtimestr = automakephonenumber.creat_phone()
                    elif inputtapinputtext.auto_input_type == '13':  #身份证号
                        inputtextwithtimestr = automakeidnumber.create_IDcard()

                    else:
                        inputtextwithtimestr = u"自动输入字符的类型不正确,请输入正确的自动输入字符的类型"
                        activebrowser.outPutErrorMyLog(u"自动输入字符的类型不正确,请输入正确的自动输入字符的类型")
                else:
                    if inputtapinputtext.is_with_time:
                        inputtextwithtimestr = "%s%s"%(inputtapinputtext.input_text,timestr)
                    else:
                        inputtextwithtimestr = inputtapinputtext.input_text

                if inputtapinputtext.input_ele_find!=None and inputtapinputtext.input_ele_find_value != None:
                    activebrowser.findEleAndInputNum(0,inputtapinputtext.input_ele_find,
                                                     inputtapinputtext.input_ele_find_value,inputtextwithtimestr)
                if inputtapinputtext.is_check:
                    inputtext_list.append(inputtextwithtimestr)
        else:
            activebrowser.outPutErrorMyLog(u"没有找到依赖id[%s]对应的数据!" % newaddid)

        return inputtext_list
    def handlerequestsheaders(self, activebrowser, apirequestdataid):
        timestr = GetTimeStr().getTimeStr()
        requestcookies_dict = {}
        from testapidatas.models import RequestCookies
        requestcookieses = RequestCookies.objects.filter(
            apirequestdata_id=int(apirequestdataid))
        if str(requestcookieses) != "<QuerySet []>":
            activebrowser.outPutMyLog("找到依赖数据")
            for requestcookies in requestcookieses:
                #处理键值对的键
                requestheader_dict_key = requestcookies.request_key

                #处理键值对的值
                if requestcookies.is_auto_input:
                    if requestcookies.auto_input_type == '1':
                        requestheader_dict_value = automakestring.getDigits(
                            requestcookies.auto_input_long)
                    elif requestcookies.auto_input_type == '2':
                        requestheader_dict_value = automakestring.getAsciiLowercase(
                            requestcookies.auto_input_long)
                    elif requestcookies.auto_input_type == '3':
                        requestheader_dict_value = automakestring.getLettersAndDigits(
                            requestcookies.auto_input_long)
                    elif requestcookies.auto_input_type == '4':
                        requestheader_dict_value = automakestring.getLetterAndDigitsAndSymbols(
                            requestcookies.auto_input_long)
                    elif requestcookies.auto_input_type == '5':
                        requestheader_dict_value = automakestring.getLetterAndDigitsAndSymbolsAndWhitespace(
                            requestcookies.auto_input_long)
                    elif requestcookies.auto_input_type == '6':
                        requestheader_dict_value = automakestring.getUnicodeZh(
                            requestcookies.auto_input_long)
                    else:
                        requestheader_dict_value = u"自动输入字符的类型不正确,请输入正确的自动输入字符的类型"
                        activebrowser.outPutErrorMyLog(
                            u"自动输入字符的类型不正确,请输入正确的自动输入字符的类型")
                else:
                    if requestcookies.is_with_time:
                        requestheader_dict_value = "%s%s" % (
                            requestcookies.input_text, timestr)
                    else:
                        requestheader_dict_value = requestcookies.input_text

                requestcookies_dict[
                    requestheader_dict_key] = requestheader_dict_value

        else:
            activebrowser.outPutErrorMyLog("没有找到依赖id[%s]对应的数据!" %
                                           apirequestdataid)
        activebrowser.outPutMyLog("requestcookies_dict:%s" %
                                  requestcookies_dict)
        return requestcookies_dict
Esempio n. 3
0
    def inputtapinputtext(self, activebrowser, newaddid):
        timestr = GetTimeStr().getTimeStr()
        inputtext_list = []
        from testdatas.models import InputTapInputText
        inputtapinputtexts = InputTapInputText.objects.filter(
            newaddandcheck_id=int(newaddid))
        if str(inputtapinputtexts) != "<QuerySet []>":
            activebrowser.outPutMyLog(u"找到依赖数据")
            for inputtapinputtext in inputtapinputtexts:
                if inputtapinputtext.is_auto_input:
                    if inputtapinputtext.auto_input_type == '1':
                        inputtextwithtimestr = automakestring.getDigits(
                            inputtapinputtext.auto_input_long)
                    elif inputtapinputtext.auto_input_type == '2':
                        inputtextwithtimestr = automakestring.getAsciiLowercase(
                            inputtapinputtext.auto_input_long)
                    elif inputtapinputtext.auto_input_type == '3':
                        inputtextwithtimestr = automakestring.getLettersAndDigits(
                            inputtapinputtext.auto_input_long)
                    elif inputtapinputtext.auto_input_type == '4':
                        inputtextwithtimestr = automakestring.getLetterAndDigitsAndSymbols(
                            inputtapinputtext.auto_input_long)
                    elif inputtapinputtext.auto_input_type == '5':
                        inputtextwithtimestr = automakestring.getLetterAndDigitsAndSymbolsAndWhitespace(
                            inputtapinputtext.auto_input_long)
                    elif inputtapinputtext.auto_input_type == '6':
                        inputtextwithtimestr = automakestring.getUnicodeZh(
                            inputtapinputtext.auto_input_long)
                    else:
                        inputtextwithtimestr = u"自动输入字符的类型不正确,请输入正确的自动输入字符的类型"
                        activebrowser.outPutErrorMyLog(
                            u"自动输入字符的类型不正确,请输入正确的自动输入字符的类型")
                else:
                    if inputtapinputtext.is_with_time:
                        inputtextwithtimestr = "%s%s" % (
                            inputtapinputtext.input_text, timestr)
                    else:
                        inputtextwithtimestr = inputtapinputtext.input_text

                if inputtapinputtext.input_ele_find != None and inputtapinputtext.input_ele_find_value != None:
                    activebrowser.findEleAndInputNum(
                        0, inputtapinputtext.input_ele_find,
                        inputtapinputtext.input_ele_find_value,
                        inputtextwithtimestr)
                if inputtapinputtext.is_check:
                    inputtext_list.append(inputtextwithtimestr)
        else:
            activebrowser.outPutErrorMyLog(u"没有找到依赖id[%s]对应的数据!" % newaddid)

        return inputtext_list
Esempio n. 4
0
    def handlerequestsdatas(self, activeapi, apirequestdataid):
        timestr = GetTimeStr().getTimeStr()
        requesturldatas_str = ""
        requesturldatas_dict = {}
        from testapidatas.models import RequestUrlDatas
        requesturldatases = RequestUrlDatas.objects.filter(
            apirequestdata_id=int(apirequestdataid))
        requesturldatases_count = requesturldatases.count()
        if str(requesturldatases) != "<QuerySet []>":
            activeapi.outPutMyLog("找到依赖数据")
            for requesturldatas in requesturldatases:
                #处理键值对的键
                requestheader_dict_key = requesturldatas.request_key

                #处理键值对的值
                if requesturldatas.is_auto_input:
                    if requesturldatas.auto_input_type == '1':
                        requestheader_dict_value = automakestring.getDigits(
                            requesturldatas.auto_input_long)
                    elif requesturldatas.auto_input_type == '2':
                        requestheader_dict_value = automakestring.getAsciiLowercase(
                            requesturldatas.auto_input_long)
                    elif requesturldatas.auto_input_type == '3':
                        requestheader_dict_value = automakestring.getLettersAndDigits(
                            requesturldatas.auto_input_long)
                    elif requesturldatas.auto_input_type == '4':
                        requestheader_dict_value = automakestring.getLetterAndDigitsAndSymbols(
                            requesturldatas.auto_input_long)
                    elif requesturldatas.auto_input_type == '5':
                        requestheader_dict_value = automakestring.getLetterAndDigitsAndSymbolsAndWhitespace(
                            requesturldatas.auto_input_long)
                    elif requesturldatas.auto_input_type == '6':
                        requestheader_dict_value = automakestring.getUnicodeZh(
                            requesturldatas.auto_input_long)
                    else:
                        requestheader_dict_value = u"自动输入字符的类型不正确,请输入正确的自动输入字符的类型"
                        activeapi.outPutErrorMyLog(
                            u"自动输入字符的类型不正确,请输入正确的自动输入字符的类型")
                else:
                    if requesturldatas.is_with_time:
                        if requesturldatas.request_value == None:
                            requesturldatas_request_value = ""
                        else:
                            requesturldatas_request_value = requesturldatas.request_value
                        requestheader_dict_value = "%s%s" % (
                            requesturldatas_request_value, timestr)
                    else:
                        if requesturldatas.request_value == None:
                            requesturldatas_request_value = ""
                        else:
                            requesturldatas_request_value = requesturldatas.request_value
                        requestheader_dict_value = requesturldatas_request_value

                requesturldatas_dict[
                    requestheader_dict_key] = requestheader_dict_value

            for key, value in requesturldatas_dict.items():
                requesturldatas_str = requesturldatas_str + "%s=%s" % (
                    key, value) + "&"

            requesturldatas_str = requesturldatas_str[:-1]  #去掉最后一位&内容

            print("requesturldatas_str:%s" % requesturldatas_str)

        else:
            activeapi.outPutErrorMyLog("没有找到依赖id[%s]对应的数据!" % apirequestdataid)
        activeapi.outPutMyLog("requesturldatas_dict:%s" % requesturldatas_dict)
        return requesturldatas_str