예제 #1
0
파일: views.py 프로젝트: siwufeiwu/py_study
def gettclistBycaseset(request):
    tcidlist = []
    tclist = []
    try:
        csid = request.GET.get('casesetid').encode('utf-8')
    except:
        csid=''
    try:
        csid_post = request.POST.get('casesetid').encode('utf-8')
        csname = request.POST.get('case_name').encode('utf-8')
        zt_bug_id = request.POST.get('zento_case_id').encode('utf-8')
    except:
        csid_post = ''
        csname = ''
        zt_bug_id = ''
    if csid_post:
        csid = csid_post
    if csid:
        cstotc = CasesetToTestcase.objects.filter(caseset_id=int(csid))
        for item in cstotc:
            tcidlist.append(item.testcase_id)
    if tcidlist:
        tclist = Testcase.objects.filter(id__in=tcidlist)
        if tclist and csname:
            tclist = tclist.filter(case_name__icontains=csname)
        if tclist and zt_bug_id:
            tclist = tclist.filter(zento_bug_id__icontains=zt_bug_id)
    page_dic = getpagelist(request, tclist)

    return render(request, 'testcase_list_cs.html', {'pages': page_dic['pages'],'perpage':page_dic['perpage'],'casesetid':csid})
예제 #2
0
파일: views.py 프로젝트: siwufeiwu/py_study
def querytcByCaseSid(request,id):
    tcidlist = []
    ctclist = CasesetToTestcase.objects.filter(Q(caseset_id=id))

    for item in ctclist:
        tcidlist.append(item.testcase_id)
    object_list = Testcase.objects.filter((Q(id__in=tcidlist)))
    page_dic = getpagelist(request, object_list)

    return page_dic
예제 #3
0
파일: views.py 프로젝트: siwufeiwu/py_study
def gettcBySearch(request):

    try:
        case_name = request.POST.get('name')
        zento_case_id = request.POST.get('zentoid')
        product_id = request.POST.get('producid')
        module_id = request.POST.get('moduleid')
        smoke= str(request.POST.get('smoke'))
        casesetid = request.POST.get('casesetid').strip()
    except:
        case_name = ''
        zento_case_id = ''
        product_id = ''
        module_id = ''
        is_smoke = ''

    if smoke.find('True') > -1:
        is_smoke = True
    elif smoke.find('False') > -1:
        is_smoke = False
    else:
        is_smoke = ''

    object_list = Testcase.objects.all()

    if product_id:
        interfacelist = []
        interface_list = Interface.objects.filter(Q(product_id=int(product_id)))
        for interface in interface_list:
            interfacelist.append(interface.id)
        object_list = object_list.filter(Q(interface_id__in=interfacelist))
    if case_name:
        object_list = object_list.filter(Q(case_name__icontains=case_name))
    if zento_case_id:
        object_list = object_list.filter(Q(zento_case_id__icontains=zento_case_id))
    if module_id:
        interfacelist = []
        interface_list = Interface.objects.filter(Q(module_id=int(module_id)))
        for interface in interface_list:
            interfacelist.append(interface.id)
        object_list = object_list.filter(Q(interface_id__in=interfacelist))

    if type(is_smoke) == type(True):
        object_list = object_list.filter(Q(is_smoke=is_smoke))

    page_dic = getpagelist(request, object_list)

    if casesetid !='0':
        tclistbycaseset = []
        for item in CasesetToTestcase.objects.filter(Q(caseset_id=casesetid)):
            tclistbycaseset.append(item.testcase_id)
        caseset = Caseset.objects.get(id=casesetid)
        return render(request, 'tclist.html', {'pages': page_dic['pages'], 'perpage': page_dic['perpage'],'caseset':caseset,'tcidlist_caseset':tclistbycaseset})
    else:
        return render(request, 'tclist.html', {'pages': page_dic['pages'], 'perpage': page_dic['perpage']})
예제 #4
0
파일: views.py 프로젝트: siwufeiwu/py_study
def gettcresult(request):
    reslist = []
    try:
        casesetid = request.GET.get('casesetid').strip()
        testcaseid = request.GET.get('testcaseid').strip()
    except:
        casesetid = ''
        testcaseid = ''
    if testcaseid and casesetid:
        reslist = Res.objects.filter(case_id=int(testcaseid),caseset_id=int(casesetid))
    page_dic = getpagelist(request, reslist)
    return render(request, 'testcase_result_all.html', {'pages': page_dic['pages'],'perpage':page_dic['perpage'], 'casesetid': casesetid,'testcaseid':testcaseid})
예제 #5
0
파일: views.py 프로젝트: siwufeiwu/py_study
def getCasesetList(request):
    product_filter_status = True

    productlist = Product.objects.filter(Q(status=product_filter_status))
    try:
        name = request.GET.get('name').strip()
        producid = request.GET.get('producid').strip()
    except:
        name = ''
        producid = ''

    object_list = Caseset.objects.with_case_count()

    if name:
        object_list = getcslistByName(object_list,name)
    if producid:
        object_list = getcslistByProduct(object_list, int(producid))

    page_dic = getpagelist(request, object_list)

    return render(request, 'caseset_list.html',{'pages': page_dic['pages'], 'perpage': page_dic['perpage'], 'productlist': productlist})
예제 #6
0
def getModulelist(request):
    product_filter_status = True
    product_name_list = Product.objects.filter(Q(status=product_filter_status))
    try:
        module = request.GET.get('module_name')
        product = request.GET.get('product_id')
    except:
        module = ''
        product = ''
    object_list = Modules.objects.all()

    if module:
        object_list = object_list.filter(Q(module_name__icontains=module))
    if product:
        object_list = object_list.filter(Q(product_id=product))
    page_dic = getpagelist(request, object_list)
    return render(
        request, 'modules_list.html', {
            'pages': page_dic['pages'],
            'perpage': page_dic['perpage'],
            'productlist': product_name_list
        })
예제 #7
0
파일: views.py 프로젝트: siwufeiwu/py_study
def get_tclist_byifid(request,id):
     try:
          case_name = request.GET.get('case_name').strip()
          case_id = request.GET.get('case_id').strip()
     except:
          case_name = ''
          case_id = ''
          reqmethod = ''

     object_list = Testcase.objects.all()

     if id:
          interface = Interface.objects.get(id=id)
          reqmethod = interface.reqmethod
          object_list = object_list.filter(Q(interface_id=id))
     if case_name:
          object_list = object_list.filter(Q(case_name__icontains=case_name))
     elif case_id:
          object_list = object_list.filter(Q(id__icontains=case_id))

     page_dic = getpagelist(request, object_list)

     return render(request, 'testcase_list.html', {'pages': page_dic['pages'],'perpage':page_dic['perpage'], 'interfaceid': id,'reqmethod':reqmethod})
예제 #8
0
파일: views.py 프로젝트: siwufeiwu/py_study
def getInterfacelist(request):
     product_filter_status = True
     productlist = Product.objects.filter(Q(status=product_filter_status))
     levelchoices = InterfaceLevel.CHOICES
     try:
          name = request.GET.get('name')
          producid = request.GET.get('producid')
          level = request.GET.get('level')
     except:
          name = ''
          producid = ''
          level = ''

     object_list = Interface.objects.all()

     if name or level:
          object_list = object_list.filter(Q(name__icontains=name) & Q(level__icontains=level))
     if producid:
          object_list = object_list.filter(Q(product_id=producid))

     page_dic = getpagelist(request,object_list)

     return render(request, 'interface_list.html',{'pages': page_dic['pages'],'perpage':page_dic['perpage'],'productlist':productlist,'levelchoices':levelchoices})