Beispiel #1
0
 def test04_modify_emp_success(self, username, success, code, message,
                               http_code):
     data = {"username": username}
     response = self.emp_api.revise_emp(app.EMP_ID, app.HEADERS, data)
     logging.info("修改员工得信息为:{}".format(response.json()))
     assert_common(self, http_code, success, code, message, response)
Beispiel #2
0
 def test01_login(self, mobile, pwd, http_code, success, code, message):
     response = self.login_api.login(mobile, pwd)
     json_data = response.json()
     logging.info("登陆测试返回的数据为{}".format(json_data))
     utils.assert_common(self, response, http_code, success, code, message)
    def test03_query_emp(self,http_code, success, code, message):
        response = self.emp_api.query_emp(app.EMPID, app.HEADERS)
        logging.info("查询员工的结果为:{}".format(response.json()))

        # 断言
        assert_common(http_code, success, code, message, response, self)
Beispiel #5
0
 def test04_delete_emp(self, success, code, message, http_code):
     response = self.emp_api.delete_emp()
     logging.info("删除员工返回的数据{}".format(response.json()))
     assert_common(self, response, http_code, success, code, message)
Beispiel #6
0
 def test01_login(self, case_name, request_body, success, code, message, http_code):
     # 使用封装的接口调用登录接口,并接收返回的响应数据
     response = self.login_api.login(request_body, {"Content-Type": "application/json"})
     # 打印响应数据
     logging.info("登录的结果为:{}".format(response.json()))
     assert_common(self, http_code, success, code, message, response)
Beispiel #8
0
 def test02_username_is_not_exist(self):
     response = self.login_api.login('13900000002','123456')
     jsonData = response.json()
     logging.info("账号不存在时输入的数据为:".format(jsonData))
     assert_common(self,response,200,False,20001,"用户名或密码错误")
Beispiel #9
0
 def test03_password_error(self):
     response = self.login_api.login('13800000002','error')
     jsonData = response.json()
     logging.info("密码错误时输入的数据为:".format(jsonData))
     assert_common(self,response,200,False,20001,"用户名或密码错误")
Beispiel #10
0
 def test08_less_params_mobile(self):
     response = self.login_api.login({"password": "******"},
                                     {"Content-Type": "application/json"})
     logging.info("少参-缺少mobile的结果为:{}".format(response.json()))
     assert_common(self, 200, False, 20001, "用户名或密码错误", response)
Beispiel #11
0
 def test09_less_password(self):
     response = self.login_api.login({"mobile": "13800000002"},
                                     {"Content-Type": "application/json"})
     logging.info("少参-缺少Passowrd的结果为:{}".format(response.json()))
     assert_common(self, 200, False, 20001, "用户名或密码错误", response)
Beispiel #12
0
 def test07_params_is_null(self):
     response = self.login_api.login(None,
                                     {"Content-Type": "application/json"})
     logging.info("传入None的结果为:{}".format(response.json()))
     assert_common(self, 200, False, 99999, "抱歉,系统繁忙,请稍后重试!", response)
Beispiel #13
0
 def test10_params_is_none(self):
     response = self.login_api.login({},
                                     {"Content-Type": "application/json"})
     logging.info("无参的结果为:{}".format(response.json()))
     assert_common(self, 200, False, 20001, "用户名或密码错误", response)
Beispiel #14
0
 def test05_delete_emp_success(self, success, code, message, http_code):
     response = self.emp_api.delete_emp(app.EMP_ID, app.HEADERS)
     logging.info("删除员工得信息为:{}".format(response.json()))
     assert_common(self, http_code, success, code, message, response)
Beispiel #15
0
 def test_login(self, mobile, password, status_code, success, code, message,
                desc):
     '''测试登录成功接口'''
     response = self.login.post_login(mobile, password)
     json_data = response.json()
     assert_common(self, response, status_code, success, code, message)
Beispiel #16
0
 def test_04delete_emp(self, status_code, success, code, message, desc):
     '''测试删除员工'''
     response = self.emp.delete_emp()
     # logging.info('删除员工')
     assert_common(self, response, status_code, success, code, message)
     self.assertEqual(None, response.json().get('data'))
 def test05_del_dep(self, http_code, success, code, message):
     response_del = self.dep_api.del_url(app.DEP_ID, app.HEADERS)
     # 查看删除后的部门信息
     logging.info("部门信息:{}".format(response_del.json()))
     # 引用断言
     assert_common(self, http_code, success, code, message, response_del)
 def test_02_add_emp(self):
     response = self.employee_api.add_emp("测试username", create_phone(), app.HEADERS)
     logging.info("添加员工后的结果为:{}".format(response.json()))
     app.EMP_ID = response.json().get("data").get("id")
     logging.info("添加员工后的id为:{}".format(app.EMP_ID))
     assert_common(self, 200, True, 10000, "操作成功", response)
Beispiel #19
0
 def test05_delete_emp(self):
     response = self.emp_api.delete_emp(app.EMPID, app.HEADERS)
     # 打印删除的结果
     logging.info("删除的结果为:{}".format(response.json()))
     # 断言
     assert_common(200, True, 10000, "操作成功", response, self)
 def test_04_update_emp(self):
     jsonData = {"username": "******"}
     response = self.employee_api.modify_emp(app.EMP_ID, jsonData=jsonData, headers=app.HEADERS)
     logging.info("修改员工后的结果为:{}".format(response.json()))
     assert_common(self, 200, True, 10000, "操作成功", response)
 def test_04_modify_emp(self, username, http_code, success, code, message):
     response = self.emp_api.modify_emp(app.EMP_ID, app.HEADERS, username)
     # 打印修改的结果
     logging.info("修改员工的结果为:{}".format(response.json()))
     # 断言
     assert_common(http_code, success, code, message, response, self)
 def test_05_delete_emp(self):
     response = self.employee_api.delete_emp(app.EMP_ID, app.HEADERS)
     logging.info("删除员工后的结果为:{}".format(response.json()))
     assert_common(self, 200, True, 10000, "操作成功", response)
Beispiel #23
0
 def test02_query_emp(self, success, code, message, http_code):
     response = self.emp_api.query_emp()
     logging.info("查询员工返回的数据{}".format(response.json()))
     assert_common(self, response, http_code, success, code, message)
Beispiel #24
0
# 导包
Beispiel #25
0
 def test_01_login_success(self, jsonData, httpcode, success, code,
                           message):
     login_response = self.login_api.login(jsonData, app.headers)
     logging.info("登录的结果:{}".format(login_response.json()))
     # 断言响应体
     assert_common(httpcode, success, code, message, login_response, self)
Beispiel #26
0
 def test04_modify_emp_success(self):
     data = {"username": "******"}
     response = self.emp_api.revise_emp(app.EMP_ID, app.HEADERS, data)
     logging.info("修改员工得信息为:{}".format(response.json()))
     assert_common(self, 200, True, 10000, "操作成功", response)
 def test01_login_success(self,case_name,request_body,success,code,msg,vreify_code):
     # 使用封装的接口调用登录接口,并接收返回的响应数据
     response = self.login_api.login(request_body,headers={"Content-Tyepe":"application/json"})
     # 打印响应数据
     logging.info("登录成功的结果为:{}".format(response.json()))
     assert_common(self, vreify_code, success, code, msg, response)
Beispiel #28
0
 def test05_delete_emp_success(self):
     response = self.emp_api.delete_emp(app.EMP_ID, app.HEADERS)
     logging.info("删除员工得信息为:{}".format(response.json()))
     assert_common(self, 200, True, 10000, "操作成功", response)
Beispiel #29
0
    def test03_query_emp(self):
        response = self.emp_api.query_emp(app.EMP, app.HD)
        logging.info("查询员工的结果为:{}".format(response.json()))

        # 断言
        assert_common(200, True, 10000, "操作成功", response, self)
Beispiel #30
0
 def test02_dep_login(self, success, code, message, http_code):
     response = self.dep_api.dep(app.HEADERS)
     # 打印查看组织架构列表的结果
     logging.info("查看组织架构列表的结果为:{}".format(response.json()))
     # 断言
     assert_common(self, http_code, success, code, message, response)