def test_get_user_dingDingUser(self, test1, test2, case): """ 钉钉——获取用户详情 :return: """ print(test1) print(test2) print(case) uri = "/api/user/dingDingUser" allure.attach(SX_IM_API + uri, "地址", allure.attachment_type.TEXT) headers = Login_Headers allure.attach(json.dumps(headers, ensure_ascii=False, indent=4), "请求头", allure.attachment_type.TEXT) common = Common() response = common.get(uri, params1=test1, params2=test2, headers=headers) allure.attach( json.dumps(response.json(), ensure_ascii=False, indent=4), "响应", allure.attachment_type.TEXT) code = int(response.status_code) code1 = int(json.loads(response.text)["code"]) code2 = json.loads(response.text)["desc"] assert case == json.loads(response.text)["data"]['userName'] # assert case==code3 if code == 200 and code1 == 200 and code2 == "ok": print("---------/api/user/dingDingUser接口调用成功") else: print("---------/api/user/dingDingUser接口调用失败")
def test_dingDingDeptList(self, test1, test2): self.db.get(test2) uri = "/api/user/dingDingDeptList" allure.attach(SX_IM_API + uri, "地址", allure.attachment_type.TEXT) headers = Login_Headers allure.attach(json.dumps(headers, ensure_ascii=False, indent=4), "请求头", allure.attachment_type.TEXT) common = Common() response = common.get(uri, params1=test1, params2=test2, headers=headers) allure.attach( json.dumps(response.json(), ensure_ascii=False, indent=4), "响应", allure.attachment_type.TEXT) code = int(response.status_code) code1 = json.loads(response.text)["code"] deftid = json.loads(response.text)["data"][0]["deptId"] print(code1) print(deftid) print(self.db.get(test2)) # assert self.db.get(test2)== deftid if code == 200 and str(code1 == 0): print("---------/api/user/dingDingGetUserLeader接口调用成功") else: print("---------/api/user/dingDingGetUserLeader接口调用失败")
def test_get_mer_addorupdate(self, merchantName_id): uri = "/api/merchant/getMerchant/{}".format(merchantName_id) data = {"id": merchantName_id} headers1 = login_headers comm = Common() status = comm.get(uri, data, headers1) if status: merchantName_id, is_delete = self.test_select_db( merchantName_id=merchantName_id) print("商户的id能够正常的显示,id为{}".format(merchantName_id)) else: print("商户的id")
def test_get_user_dingDingDeptUserList(self, test1, test2): """ 钉钉-获取部门下所有员工 做缓存 """ uri = "/api/user/dingDingDeptUserList" allure.attach(SX_IM_API + uri, "地址", allure.attachment_type.TEXT) headers = Login_Headers allure.attach(json.dumps(headers, ensure_ascii=False, indent=4), "请求头", allure.attachment_type.TEXT) common = Common() response = common.get(uri, params1=test1, params2=test2, headers=headers) allure.attach( json.dumps(response.json(), ensure_ascii=False, indent=4), "响应", allure.attachment_type.TEXT) code = int(response.status_code) code1 = json.loads(response.text)["code"] if code == 200 and str(code1 == 200): print("---------/api/user/dingDingDeptUserList接口调用成功") else: print("---------/api/user/dingDingDeptUserList接口调用失败")
def test_get_user_dingDingDept(self): """ 钉钉——获取部门列表 :return: """ uri = "/api/user/dingDingDept" allure.attach(SX_IM_API + uri, "地址", allure.attachment_type.TEXT) headers = Login_Headers allure.attach(json.dumps(headers, ensure_ascii=False, indent=4), '请求头', allure.attachment_type.TEXT) common = Common() response = common.get(uri, headers=headers) allure.attach( json.dumps(response.json(), ensure_ascii=False, indent=4), "响应", allure.attachment_type.TEXT) print(response.text) code = int(response.status_code) code1 = json.loads(response.text)["code"] code2 = json.loads(response.text)["desc"] if code == 200 and code1 == 0 and code2 == "ok": print("——————————/api/user/dingDingDept调用成功") else: print("——————————/api/user/dingDingDept调用失败")