def test_sysUser_page(self, gettokenfixture, key, value, expect): #用户管理查询接口测试 s = gettokenfixture self.log.info('-----用户查询接口-----') r = SRMBase(s) msg = r.sysUser_page(key, value) self.log.info('获取请求结果:%s' % msg.json()) result = jsonpath.jsonpath(msg.json(), '$..phone')[0] assert result == expect
def test_sysuser(self, sysUser_sql, gettokenfixture, username, phone, expect): # 用户新增接口测试 s = gettokenfixture self.log.info('-----用户新增接口-----') shili = SRMBase(s) msg = shili.sysuser(username, phone) ass = shili.sysUser_page("userName", username) print("查询结果是{}".format(ass.text)) ass_phone = jsonpath.jsonpath(ass.json(), '$..phone')[0] self.log.info('获取请求结果:%s' % msg.json()) assert msg.json()["success"] == expect["success"] assert ass_phone == phone
def test_SysUser_put(self, gettokenfixture, username, phone, role, expect, expect1, expect2): s = gettokenfixture self.log.info('-----用户编辑接口-----') r = SRMBase(s) putmsg = r.SysUser_put(username, phone, role) self.log.info('获取请求结果:{}'.format(putmsg.json())) selmsg = r.sysUser_page("phone", "15555555552") self.log.info('获取请求结果:{}'.format(selmsg.json())) result = jsonpath.jsonpath(selmsg.json(), '$..phone')[0] result1 = jsonpath.jsonpath(selmsg.json(), '$..userName')[0] result2 = jsonpath.jsonpath(selmsg.json(), '$..roleNames')[0] print(result2) assert result == expect assert result1 == expect1 assert result2 == expect2