test_roleSetting.py
1.13 KB
from atdd.PcPost import PcPost
class RoleSetting(PcPost):
def setUp(self):
self.do_login(self.host, self.mobile, self.psw, self.domain)
# 角色list——角色管理页面
def test_getRoleList(self):
interfaceUrl = "/Contact/Apicp/Role/List"
data = {
"page": 1,
"limit": 10
}
result = self.PcPost(interfaceUrl,data)
return result
# 获取所有角色的ID,以list格式返回
def get_all_roleId(self):
roleList = self.test_getRoleList()['result']['list']
roleIdList = []
for i in range(len(roleList)):
jobId = roleList[i]['roleId'].split()
# 将jobId加入到jobIdList中
roleIdList[len(roleIdList):len(roleIdList)] = jobId
return roleIdList
# 根据角色名称获取角色ID
def getRoleID(self, roleName):
roleList = self.test_getRoleList()['result']['list']
for i in range(len(roleList)):
if (roleList[i]['roleName'] == roleName):
roleId = roleList[i]['roleId']
else:
roleId = None
return roleId