def testCaseAddPage(request, context): langDict = getLangTextDict(request) context["page"] = 1 context["option"] = "add" context["addHTTPTestCase"] = "current-page" context["checkBusinessLine"] = dbModelListToListDict( BusinessService.getAllBusinessLine()) context["checkModules"] = dbModelListToListDict( ModulesService.getAllModules()) if not isRelease: context["env"] = "test" #文本 text = {} text["pageTitle"] = langDict["web"]["httpTestCasePageHeadings_%s" % context["option"]] text["subPageTitle"] = langDict["web"]["httpTestCaseSubPageTitle_%s" % context["option"]] context["text"] = text #页面所需参数 context["loginName"] = request.session.get("loginName") context.update(getConfigs(request)) context["debugBtnCount"] = commonWebConfig.debugBtnCount #调试按钮 getDebugBtnList = getDebugBtn(request) context.update(getDebugBtnList) context["title"] = "添加HTTP业务流" return render(request, "InterfaceTest/HTTPTestCase/HTTP_testCase.html", context)
def interfaceAddPage(request,context): interfaceAutoFillKey = "interfaceAutoFill_%s_%s" % (request.session.get("loginName"), int(time.time() * 1000)) langDict = getLangTextDict(request) if request.GET.get("sendParam", None): params = request.GET.get("param", None) if params: RedisCache().set_data(interfaceAutoFillKey, params) RedisCache().expire_data(interfaceAutoFillKey, 60) context["interfaceAutoFillKey"] = interfaceAutoFillKey context["option"] = "add" context["mockaddHTTPInterface"] = "current-page" if not isRelease: context["env"] = "test" # 文本 text = {} text["pageTitle"] = "添加MOCK接口" text["subPageTitle"] = "添加MOCK接口" context["text"] = text # 页面所需参数 context.update(getConfigs(request)) context.update(getServiceConf(request)) context["debugBtnCount"] = commonWebConfig.debugBtnCount # 调试按钮 getDebugBtnList = getDebugBtn(request) context.update(getDebugBtnList) addUserLog(request, "MOCK服务->添加MOCK->页面展示->成功", "PASS") context["title"] = "添加HTTP MOCK" context["importStr"] = getPythonThirdLib() return render(request, "mock_server/http/HTTP_interface.html", context)
def interfaceAddPage(request, context): langDict = getLangTextDict(request) context['option'] = request.GET.get("option", "add") context['mockid'] = request.GET.get("mockid", 0) context["addHTTPInterface"] = "current-page" if not isRelease: context["env"] = "test" # 文本 text = {} text["pageTitle"] = langDict["web"]["httpInterfacePageHeadings_%s" % context["option"]] text["subPageTitle"] = langDict["web"]["httpInterfaceSubPageTitle_%s" % context["option"]] context["text"] = text # 页面所需参数 context.update(getConfigs(request)) context.update(getServiceConf(request)) context["debugBtnCount"] = commonWebConfig.debugBtnCount # 调试按钮 getDebugBtnList = getDebugBtn(request) context.update(getDebugBtnList) addUserLog(request, "单接口管理->添加用例->页面展示->成功", "PASS") context["title"] = "添加HTTP接口" return render(request, "InterfaceTest/HTTPInterface/HTTP_interface.html", context)
def operationInterface(request, context): langDict = getLangTextDict(request) context["id"] = request.GET.get("id", -1) context["option"] = request.GET.get("option") context["addBy"] = request.GET.get("addBy") try: if int(context["id"]) <= 0: interfaceId = request.GET.get("interfaceId") interObj = HTTP_interfaceService.getInterfaceByInterfaceId( interfaceId) return redirect( "/interfaceTest/HTTP_operationInterface?id=%s&option=%s" % (interObj.id, context["option"])) except: return render(request, "permission/page_404.html") context["addHTTPInterface"] = "current-page" if not isRelease: context["env"] = "test" try: if VersionService.isCurrentVersion(request): context["dataAddBy"] = HTTP_interfaceService.getInterfaceForId( request.GET.get("id")).addBy.loginName else: context[ "dataAddBy"] = HTTP_interfaceService.getVersionInterfaceForId( request.GET.get("id")).addBy.loginName except Exception as e: return render(request, "permission/page_404.html") # 文本 text = {} try: text["pageTitle"] = langDict["web"]["httpInterfacePageHeadings_%s" % context["option"]] text["subPageTitle"] = langDict["web"]["httpInterfaceSubPageTitle_%s" % context["option"]] except Exception as e: return HttpResponse("参数错误 %s" % e) context["text"] = text context.update(getConfigs(request)) context.update(getServiceConf(request)) context["debugBtnCount"] = commonWebConfig.debugBtnCount getDebugBtnList = getDebugBtn(request) context.update(getDebugBtnList) context["serviceJson"] = json.dumps( ServiceConfService.queryServiceConfSort(request)) context["title"] = "HTTP接口-" + request.GET.get("id") return render(request, "InterfaceTest/HTTPInterface/HTTP_interface.html", context)
def operationInterface(request, context): langDict = getLangTextDict(request) context["id"] = request.GET.get("id") context["option"] = request.GET.get("option") context["addHTTPInterface"] = "current-page" context["title"] = "HTTP MOCK-" + request.GET.get("id") if not isRelease: context["env"] = "test" try: if VersionService.isCurrentVersion(request): context["dataAddBy"] = MockHttpService.getInterfaceForId( request.GET.get("id")).addBy else: context["dataAddBy"] = MockHttpService.getVersionInterfaceForId( request.GET.get("id")).addBy except Exception as e: return render(request, "permission/page_404.html") # 文本 text = {} try: text["pageTitle"] = "MOCK接口" if context["option"] == "select": text["subPageTitle"] = "查看MOCK接口" elif context["option"] == "edit": text["subPageTitle"] = "编辑MOCK接口" elif context["option"] == "copy": text["subPageTitle"] = "添加MOCK接口" except Exception as e: return HttpResponse("参数错误 %s" % e) context["text"] = text context.update(getConfigs(request)) context.update(getServiceConf(request)) context["debugBtnCount"] = commonWebConfig.debugBtnCount getDebugBtnList = getDebugBtn(request) context.update(getDebugBtnList) context["serviceJson"] = json.dumps( ServiceConfService.queryServiceConfSort(request)) context["importStr"] = getPythonThirdLib() return render(request, "mock_server/http/HTTP_interface.html", context)
def operationTestCase(request, context): langDict = getLangTextDict(request) context["id"] = request.GET.get("id") context["option"] = request.GET.get("option") context["addBy"] = request.GET.get("addBy") context["title"] = "HTTP业务流-" + request.GET.get("id") context["page"] = 1 context["addHTTPTestCase"] = "current-page" if not isRelease: context["env"] = "test" try: if VersionService.isCurrentVersion(request): context["dataAddBy"] = HTTP_test_caseService.getTestCaseForId( request.GET.get("id")).addBy.loginName else: context[ "dataAddBy"] = HTTP_test_caseService.getVersionTestCaseForId( request.GET.get("id")).addBy.loginName except Exception as e: return HttpResponse("参数id错误 %s" % e) #文本 text = {} try: text["pageTitle"] = langDict["web"]["httpTestCasePageHeadings_%s" % context["option"]] text["subPageTitle"] = langDict["web"]["httpTestCasePageHeadings_%s" % context["option"]] except Exception as e: return HttpResponse("参数错误 %s" % e) context["text"] = text context.update(getConfigs(request)) context.update(getServiceConf(request)) context["debugBtnCount"] = commonWebConfig.debugBtnCount getDebugBtnList = getDebugBtn(request) context.update(getDebugBtnList) context["serviceJson"] = json.dumps( ServiceConfService.queryServiceConfSort(request)) return render(request, "InterfaceTest/HTTPTestCase/HTTP_testCase.html", context)