Browse Source

未登录拟在建项目详情页

zangyamei 6 months ago
parent
commit
ca8acf27d3
2 changed files with 23 additions and 1 deletions
  1. 15 0
      cases/pc/未登录功能/三级页/nzj_details.py
  2. 8 1
      lib/webapi.py

+ 15 - 0
cases/pc/未登录功能/三级页/nzj_details.py

@@ -0,0 +1,15 @@
+from hytest import *
+from lib.webapi import apimgr
+
+class c1:
+    name = '未登录拟在建项目详情页'
+    def teststeps(self):
+        INFO('测试步骤')
+        STEP(1, '第一步调用函数')
+        res=apimgr.nzj_details()#调用 webapi.apimgr 模块中的 nzj_details 方法
+        r = res.json()#将 API 响应内容解析为 JSON 格式,并存储在变量 r 中
+        INFO(r)#输出完整的 API 响应内容,方便调试和查看
+        actural=r['error_code']#actural:用来存储从 API响应的 JSON 数据中提取的 'error_code' 键对应的值
+        STEP(2, '第二步设置检查点')
+        # 设置检查点
+        CHECK_POINT('未登录拟在建项目详情页接口是否正常',  actural == 0 )#断言检查,设置了一个检查点,用来验证 'error_code' 是否等于 0

+ 8 - 1
lib/webapi.py

@@ -1259,7 +1259,14 @@ class APIMgr():
         response = self.s.post(f"{cfg.target_host}/entnicheNew/subscribe/pushset/update", headers=headers,data=data)
         return response
 
-
+    #未登录“拟在建项目”详情页
+    def nzj_details(self):
+        headers = GSTORE['headers']
+        params = {
+           "pid":"040709005b58070d4a46020952075350590c1d4302530802"
+        }
+        response = self.s.get(f"{cfg.target_host}/front/project/nzj/details", headers=headers,params=params)
+        return response
 
 apimgr = APIMgr()