Example #1
0
 def __init__(self):
     # 获取日志器
     self.log = GetLog.get_logger()
     # 新增员工 url
     self.add_url = api.host + "/api/sys/user"
     # 修改员工 url
     self.update_url = api.host + "/api/sys/user/{}"
     # 查询员工 url
     self.search_url = api.host + "/api/sys/user/{}"
     # 删除员工 url
     self.delete_url = api.host + "/api/sys/user/{}"
Example #2
0
 def __init__(self):
     self.url_login = api.host + "/api/sys/login"
     self.log = GetLog.get_logger()
Example #3
0
 def setUp(self):
     self.login = Login()
     self.log = GetLog.get_logger()
Example #4
0
from get_log import GetLog

log = GetLog.get_logger()


def asser_common(self,
                 response,
                 status_code=200,
                 success=True,
                 code=10000,
                 message="操作成功!"):  # self为TestCase实例
    # response为:响应对象
    try:
        r = response.json()
        # 断言
        # 断言状态码 200
        self.assertEqual(status_code, response.status_code)
        # 断言success True
        self.assertEqual(success, r.get("success"))
        # 断言code 10000
        self.assertEqual(code, r.get("code"))
        # 断言message 操作成功!
        self.assertEqual(message, r.get("message"))
    except Exception as e:
        log.error(e)
        # 抛异常
        raise
Example #5
0
 def setUp(self):
     self.employee = Employee()
     self.log = GetLog.get_logger()