def test04_delete(self): # 调用删除接口 r = self.api.api_delete_employee(api.user_id) print("删除数据结果为:", r.json()) # 断言 assert_common(self,r)
def test1_add(self,username="******",mobile="15046538795",worknumber="59873"): response = self.apicase.insert_user(username,mobile,worknumber) print("添加之后的响应数据为:",response.json()) # 获取添加员工之后的id api.USER_ID = response.json().get("data").get("id") print("获取到的id为:", api.USER_ID) assert_common(self,response)
def test03_get(self): # 调用api_employee里的api_get_employee r = self.api.api_get_employee() print("查询员工名称结果为:", r.json()) # 断言 assert_common(self,r)
def test_04_delete(self): r = self.api.delete_user() print("删除员工返回的响应信息:{}".format(r.json())) logging.info("删除员工返回的响应信息:{}".format(r.json())) # 断言 assert_common(self, r)
def test01_post(self,username,mobile,workNumber): r = self.api.api_post_employee(username,mobile,workNumber) print("新增员工后结果:",r.json()) api.user_id=r.json().get("data").get("id") print("新增的员工id为",api.user_id) assert_common(self,r)
def test01_add(self, username, mobile, workNumber): logging.info(f"{username},{mobile},{workNumber}") r = self.apiemplyee.api_post_employee(username, mobile, workNumber) logging.info(f"HR系统添加会员响应json信息{r.json()}") print(r.json()) api.user_id = r.json().get("data").get("id") assert_common(self, r)
def test01_post(self, username="******", mobile="13015214222", workNumber="888"): r = self.api.api_post_employee(username, mobile, workNumber) api.user_id = r.json().get("data").get("id") assert_common(self, r)
def test_04(self): # 调用删除接口 r = self.api.api_delete_emp(api.user_id) print("删除数据结果为:", r.json()) # 断言 assert_common(self, r)
def test01_post(self, username, mobile, workNumber): r = self.api.api_post_employee(username, mobile, workNumber) assert_common(self, r) log.info("新增员工结果为:{}".format(r.json())) api.user_id = r.json().get("data").get("id") print("员工user_id的值为", api.user_id) log.info("新增员工后提取的员工id为{}".format(api.user_id))
def test02_put(self,username="******"): # 调用api_employee里的api_put_employee r = self.api.api_put_employee(username) print("更新员工名称结果为:", r.json()) #断言 assert_common(self,r)
def test_02_get(self): r = self.api.get_user() print("查询添加的员工的信息:{}".format(r.json())) logging.info("查询添加的员工的信息:{}".format(r.json())) # 断言 assert_common(self, r)
def test01_post(self,username="******",mobile="1315644258",workNumber="1298985"): r = self.api.api_post_employee(username,mobile,workNumber) print("新增员工和结果",r.json()) #提取user_id api.user_id = r.json().get("data").get("id") # 断言 assert_common(self,r)
def test02_put(self, username="******"): # 调用更新接口方法 # data={"username":username} r = self.emp.api_put_employee(username) print("修改员工响应结果为:", r.json()) # 断言 assert_common(self, r)
def test01_login(self, mobile="13800000002", password="******"): r = self.api_login.api_login(mobile, password) # 断言 print(r.json()) assert_common(self, r) token = r.json().get("data") api.headers['Authorization'] = "Bearer " + token print(api.headers)
def test01_login(self, mobile="13800000002", password="******"): # 调用登录测试方法: r = self.login.api_login(mobile, password) token = r.json().get("data") api.headers['Authorization'] = "Bearer " + token print("登录成功后的headers的值为: ", api.headers) # 断言 assert_common(self, r)
def test01_post(self): # 调用新增接口 response = self.employee.api_post_employee("gz-day-v012", "13575400100", "14159627") # 断言 assert_common(self, response) # 提取id值 追加到api公共变量 api.user_id = response.json().get("data").get("id")
def test01_login(self, mobile="13800000002", password="******"): r = self.login.api_login(mobile, password) print(r.json()) print(r.status_code) token = r.json().get("data") d = api.headers["Authorization"] = "Bearer " + token print(api.headers) assert_common(self, r)
def test01_post(self, username, mobile, workNum): # 调用新增接口 r = self.emp.api_post_employee(username, mobile, workNum) # 提取user_id print("添加员工响应结果为:", r.json()) api.user_id = r.json().get("data").get("id") print("添加员工成功后id值为:", api.user_id) # 断言 assert_common(self, r)
def test01_post(self, username="******", mobile="17010331120", worNumber="10233402"): # 调用新增员工接口 r = self.api.api_post_employee(username, mobile, worNumber) # 断言 assert_common(self, r) print("新增员工结果:", r.json()) # 提取 user_id api.user_id = r.json().get("data").get("id") print("员工user_id值为:", api.user_id)
def test01_post(self, username='******', mobile='13912345687', workNumber='334477'): # 调用新增接口 r = self.api.api_post_employee(username, mobile, workNumber) print("新增员工后结果为:",r.json()) # 提取 user_di api.user_id = r.json().get("data").get("id") print("新增的员工id为:", api.user_id) # 断言 assert_common(self,r)
def test_login(self, mobile="13800000002", password="******"): response = self.login.api_login(mobile, password) print(response.json()) # 获取响应数据结果 # 提取token token = response.json().get("data") api.headers["Authorization"] = "Bearer " + token print("登录成功后的headers值为:", api.headers) # 断言. assert_common(self, response)
def test01_post(self, username="******", mobile="13822232222", wordNumber="831043"): r = self.api.api_post(username, mobile, wordNumber) print("新增员工为:", r.json()) api.user_id = r.json().get("data").get("id") print("新增员工ID为:", api.user_id) assert_common(self, r)
def test01_login(self, mobile="13800000002", password="******"): # 调用业务方法 r = self.apl_login.api_login(mobile, password) # 提取token token = r.json().get("data") api.headers['Authorization'] = "Bearer " + token print("登录成功header值位:", api.headers) # 断言 assert_common(self, r)
def test01_post(self, username, mobile, workNumber): #调用新增接口 r = self.api.api_post_employee(username, mobile, workNumber) print("新增的员工id为:", r.json()) #提取 user_id api.user_id = r.json().get("data").get("id") print("新增的员工id为:", api.user_id) #断言 assert_common(self, r)
def test_03_put(self, username="******"): r = self.api.put_user(username) print("修改员工的信息:{}".format(r.json())) logging.info("修改员工的信息:{}".format(r.json())) # logging.info("修改员工的信息:{}".format(r.json())) # 断言 assert_common(self, r)
def test01_login_success(self,mobile='13800000002',password="******"): r= self.api_login.api_login(mobile,password) print(r.json()) #获取token token = r.json().get("data") api.headers["Authorization"]="Bearer "+token print("登录后的headers为: ",api.headers) #断言 assert_common(self,r)
def test01_insert_employee(self, username, mobile, workNumber): """测试添加员工""" rep = self.employee.insert_employee(username, mobile, workNumber) print("insert_employee", rep.json()) print(rep.status_code) # 提取用户的id api.USER_ID = rep.json().get("data").get("id") # 断言 assert_common(self, rep)
def test01_post(self, username, mobile, worNumber): # 调用新增接口 r = self.api.api_post_employee(username, mobile, worNumber) # 断言 assert_common(self, r) print("新增员工结果:", r.json()) # 提取user_id api.user_id = r.json().get("data").get("id") log.info("员工的id:", api.user_id) print("员工user_id值为:", api.user_id)
def test_login(self,mobile="13800000002",password="******"): # 调用业务方法 r = self.login.api_login(mobile,password) print(r.json()) # 提取token token = r.json().get("data") api.headers["Authorization"] = "Bearer "+token print("登陆成功后的headers值为: ",api.headers) # 断言 assert_common(self,r)
def test_01_post(self, username, mobile, workNumber): r = self.api.post_user(username, mobile, workNumber) print("添加员工返回的响应信息:{}".format(r.json())) logging.info("添加员工返回的响应信息:{}".format(r.json())) api.user_id = r.json().get("data").get("id") print("新增员工的id为:{}".format(api.user_id)) logging.info("新增员工的id为:{}".format(api.user_id)) #断言 assert_common(self, r)