コード例 #1
0
def operationTask(request, context):
    langDict = getLangTextDict(request)

    context["option"] = request.GET.get("option")
    context["page"] = 1
    if not isRelease:
        context["env"] = "test"
    try:
        if VersionService.isCurrentVersion(request):
            context["dataAddBy"] = HTTP_taskService.getTaskForId(
                request.GET.get("id")).addBy.loginName
        else:
            context["dataAddBy"] = HTTP_taskService.getVersionTaskForId(
                request.GET.get("id"),
                request.session.get("version")).addBy.loginName

    except Exception as e:
        print(traceback.format_exc())
        return render(request, "permission/page_404.html")

    context["checkBusinessLine"] = dbModelListToListDict(
        BusinessService.getAllBusinessLine())
    context["checkModules"] = dbModelListToListDict(
        ModulesService.getAllModules())
    context["id"] = request.GET.get("id")
    context["interfacePage"] = 1
    context["testCasePage"] = 1
    context["taskAdd"] = "current-page"
    text = {}
    text["pageTitle"] = langDict["web"]["httpTaskPageHeadings_%s" %
                                        context["option"]]
    context["text"] = text
    context.update(getServiceConf(request))
    return render(request, "InterfaceTest/HTTPTask/HTTP_taskAdd.html", context)
コード例 #2
0
def testCaseAddPage(request, context):
    langDict = getLangTextDict(request)

    context["page"] = 1
    context["option"] = "add"
    context["dubbo_addHTTPTestCase"] = "current-page"
    context["checkBusinessLine"] = dbModelListToListDict(
        BusinessService.getAllBusinessLine())
    context["checkModules"] = dbModelListToListDict(
        ModulesService.getAllModules())
    if not isRelease:
        context["env"] = "test"
    # 文本
    text = {}
    text["pageTitle"] = langDict["dubbo"]["dubboTestCasePageHeadings_%s" %
                                          context["option"]]
    text["subPageTitle"] = langDict["dubbo"]["dubboTestCaseSubPageTitle_%s" %
                                             context["option"]]
    context["text"] = text

    # 页面所需参数
    context["loginName"] = request.session.get("loginName")
    context.update(getConfigs(request))

    context["debugBtnCount"] = commonWebConfig.debugBtnCount

    # 调试按钮
    getDebugBtnList = ConfigServiceForDubbo.getDebugBtn(request)
    context.update(getDebugBtnList)

    context["title"] = "添加DUBBO业务流"
    return render(request, "dubbo/testcase/testCase.html", context)
コード例 #3
0
def http_interfaceCheck(request):
    request.session['groupLevel1'] = groupLevel1
    request.session['groupLevel2'] = groupLevel2
    request.session['isReleaseEnv'] = isRelease

    langDict = getLangTextDict(request)
    context = {}
    if not isRelease:
        context["env"] = "test"
    context["mockinterfaceCheck"] = "current-page"
    context["userName"] = request.session.get("userName")
    context["checkBusinessLine"] = dbModelListToListDict(
        BusinessService.getAllBusinessLine())
    context["checkModules"] = dbModelListToListDict(
        ModulesService.getAllModules())
    # 文本
    text = {}
    text["pageTitle"] = "MOCK接口查看"
    context["text"] = text
    context["page"] = 1
    # context["lang"] = getLangTextDict(request)
    context["uri"] = UriService.getUri(request, "HTTP")

    addUserLog(request, "MOCK管理->查看MOCK->页面展示->成功", "PASS")
    context["title"] = "HTTP MOCK"
    return render(request, "mock_server/http/HTTP_interface_check.html",
                  context)
コード例 #4
0
def getBusinessLineAndModuleRelation(request):
    businessLineListData = dbModelListToListDict(BusinessService.getAllBusinessLine())
    resultDict = {}
    for blIndex in businessLineListData:
        resultDict[blIndex["id"]] = []
        dataList = dbModelListToListDict(TbBusinessLineModuleRelation.objects.filter(businessLineId__bussinessLineName=blIndex["bussinessLineName"],businessLineId__state=1).order_by("level"))
        for index in dataList:
            resultDict[blIndex["id"]].append(dbModelToDict(TbModules.objects.get(id=index["moduleId_id"])))
    return HttpResponse(ApiReturn(body=resultDict).toJson())
コード例 #5
0
def srcFileCoverCheck(request):
    langDict = getLangTextDict(request)
    context = {}

    context["srcFileCoverCheck"] = "current-page"
    context["userName"] = request.session.get("userName")
    if not isRelease:
        context["env"] = "test"

    # 文本
    text = {}
    text["pageTitle"] = langDict["web"]["srcFileAnalyzePageTitle"]
    text["subPageTitle"] = langDict["web"]["httpUserCenterGlobalVarsSubPageTitle"]
    context["text"] = text
    context["checkBusinessLine"] = dbModelListToListDict(BusinessService.getAllBusinessLine())
    context["checkModules"] = dbModelListToListDict(ModulesService.getAllModules())

    context["page"] = 1
    return render(request, "InterfaceTest/src_file_analyze/src_file_cover.html", context)
コード例 #6
0
def http_testCaseStepCheck(request):
    context = {}

    context["testCaseStepCheck"] = "current-page"
    context["userName"] = request.session.get("userName")
    context["checkBusinessLine"] = dbModelListToListDict(
        BusinessService.getAllBusinessLine())
    context["checkModules"] = dbModelListToListDict(
        ModulesService.getAllModules())
    if not isRelease:
        context["env"] = "test"
    #文本
    text = {}
    text["pageTitle"] = "HTTP用例步骤查看"
    context["text"] = text

    context["page"] = 1
    return render(request,
                  "InterfaceTest/HTTPTestCase/HTTP_testCaseStep_check.html",
                  context)
コード例 #7
0
def taskResultCheck(request):
    langDict = getLangTextDict(request)

    context = {}
    if not isRelease:
        context["env"] = "test"
    context["taskExecuteResult"] = "current-page"
    context["checkBusinessLine"] = dbModelListToListDict(
        BusinessService.getAllBusinessLine())
    context["checkModules"] = dbModelListToListDict(
        ModulesService.getAllModules())
    context["httpConf"] = HttpConfService.queryHttpConfSort(request)
    # 文本
    text = {}
    text["pageTitle"] = langDict["web"]["httpTaskCheckPageHeadings_check"]
    context["text"] = text

    context["page"] = 1
    return render(request, "InterfaceTest/HTTPTask/HTTP_task_ExecResult.html",
                  context)
コード例 #8
0
def taskAdd(request, context):
    langDict = getLangTextDict(request)
    context["interfacePage"] = 1
    context["testCasePage"] = 1
    context["option"] = "add"
    if not isRelease:
        context["env"] = "test"
    context["taskAdd"] = "current-page"
    context["checkBusinessLine"] = dbModelListToListDict(
        BusinessService.getAllBusinessLine())
    context["checkModules"] = dbModelListToListDict(
        ModulesService.getAllModules())
    context.update(getServiceConf(request))
    text = {}
    text["pageTitle"] = langDict["web"]["httpTaskPageHeadings_%s" %
                                        context["option"]]
    text["subPageTitle"] = langDict["web"]["httpTaskSubPageTitle_%s" %
                                           context["option"]]
    context["text"] = text
    # return request.session.get("loginName"),request, "InterfaceTest/HTTPTask/HTTP_taskAdd.html", context
    return render(request, "InterfaceTest/HTTPTask/HTTP_taskAdd.html", context)
コード例 #9
0
def dubbo_testCaseCheck(request):
    langDict = getLangTextDict(request)
    context = {}

    context["dubbo_testCaseCheck"] = "current-page"
    context["userName"] = request.session.get("userName")
    context["checkBusinessLine"] = dbModelListToListDict(
        BusinessService.getAllBusinessLine())
    context["checkModules"] = dbModelListToListDict(
        ModulesService.getAllModules())
    if not isRelease:
        context["env"] = "test"
    # 文本
    text = {}
    text["pageTitle"] = langDict["dubbo"]["dubboTestCasePageHeadings_check"]
    context["text"] = text

    context["page"] = 1

    # context["lang"] = getLangTextDict(request)
    context["title"] = "DUBBO业务流"
    return render(request, "dubbo/testcase/testCase_check.html", context)
コード例 #10
0
ファイル: src_file.py プロジェクト: Hanlen520/sosotest-1
def srcFileList(request):

    page = request.POST.get("page")
    if isInt(page):
        page = int(page)
    else:
        return HttpResponse("<script>alert('请验证页数参数');</script>")
    checkArr = json.loads(parse.unquote(request.POST.get("queryArr")))
    orderBy = request.POST.get("orderBy")
    if isSqlInjectable(orderBy):
        return HttpResponse("<script>alert('查询条件非法');</script>")

    if VersionService.isCurrentVersion(request):
        tbName = "tb_standard_interface"
        versionCondition = ""
    else:
        tbName = "tb_version_standard_interface"
        versionCondition = "and g.versionName='%s'" % request.session.get(
            "version")

    execSql = "SELECT g.*,m.moduleName,b.bussinessLineName FROM %s g LEFT JOIN tb_modules m on g.moduleId = m.id LEFT JOIN tb_business_line b on g.businessLineId = b.id WHERE g.state=1 %s" % (
        tbName, versionCondition)
    checkList = []
    for key in checkArr:
        if checkArr[key] == "":
            continue
        elif key == "businessLine":
            checkList.append("%%%s%%" % checkArr[key])
            execSql += """ and b.bussinessLineName LIKE %s """
            continue
        elif key == "module":
            checkList.append("%%%s%%" % checkArr[key])
            execSql += """ and m.moduleName LIKE %s """
            continue
        elif key == "fileRealPath":
            checkList.append("%%%s%%" % checkArr[key])
            execSql += """ and g.fileName LIKE %s """
            continue
        elif key == "interfaceUrl":
            checkList.append("%%%s%%" % checkArr[key])
            execSql += """ and g.interfaceUrl LIKE %s """
            continue
        elif key == "apiStatus":
            statusDict = {"有效": "1", "废弃": "0", "未发现注释": "3", "注释不合法": "4"}
            statusValue = statusDict[checkArr[key]]
            checkList.append("%s" % statusValue)
            execSql += """ and g.apiStatus = %s """
            continue
        checkList.append("%%%s%%" % checkArr[key])
        execSql += """ and g.%s """ % key
        execSql += """ LIKE %s"""
    execSql += """ ORDER BY %s""" % orderBy
    print(execSql)
    context = pagination(sqlStr=execSql,
                         attrList=checkList,
                         page=page,
                         pageNum=commonWebConfig.standardInterfacePageNum)
    context["checkBusinessLine"] = dbModelListToListDict(
        BusinessService.getAllBusinessLine())
    context["checkModules"] = dbModelListToListDict(
        ModulesService.getAllModules())
    response = render(
        request,
        "InterfaceTest/src_file_analyze/SubPages/src_file_sub_page.html",
        context)
    return response