Commit bdb200781e73459fc2427d95594edd76095846f5

Authored by 赵迎辉
2 parents b49bcddb 752ceca1

Merge branch 'master' into 'feature/zhaoyinghui'

Master



See merge request !10
README.md
  1 +先去gitlab上创建开发分支:feature/自己的名字拼音
  2 +
  3 +在本地项目中git输入命令:
  4 +git pull
  5 +
  6 +现在可以看到创建的开发分之,然后拉取开发分支
  7 +git fetch origin feature/jipeihong:feature/jipeihong
  8 +
  9 +(运行git status, 切记要没有修改)
  10 +
  11 +切换到开发分支:
  12 +git checkout feature/jipeihong
  13 +
  14 +创建本地开发分支,对应gitlab开发分支:
  15 +git checkout topic/jipeihong
  16 +
  17 +然后进行rebase:
  18 +git rebase feature/jipeihong
  19 +
  20 +(然后就可以进行你的开发了)
  21 +
  22 +查看已经修改的东西
  23 +git status
  24 +
  25 +确认好后进行提交
  26 +git add .
  27 +
  28 +接着提交
  29 +git commit -m '你的提交评论'
  30 +
  31 +然后推送到gitlab
  32 +git push origin topic/jipeihong:feature/jipeihong
  33 +
  34 +如果上面命令失败了,说明别人也同时有修改提交,需要你拉取下代码
  35 +git fetch origin feature/jipeihong:feature/jipeihong
  36 +
  37 +git rebase feature/jipeihong
  38 +
  39 +rebase没问题就可以继续前面的git push命令了。
  40 +
  41 +rebase有问题的话需要解决下冲突。
  42 +
  43 +编码注意:
  44 +1、Python测试文件前以'test_'命名;
  45 +2、类之前不需要test,类名首字母大写;
  46 +3、单词分割线用英文下划线‘_’,不要用中间线“-”;
  47 +4、随机函数random;
  48 +5、接口返回结果格式转换,以及结果中所需值的提取;
0 \ No newline at end of file 49 \ No newline at end of file
atdd/ATDDCase.py
@@ -14,12 +14,12 @@ class ATDDCase(unittest.TestCase): @@ -14,12 +14,12 @@ class ATDDCase(unittest.TestCase):
14 global list 14 global list
15 host = "https://yq.vchangyi.com" 15 host = "https://yq.vchangyi.com"
16 uc_host = "http://l-rst.vchangyi.com" 16 uc_host = "http://l-rst.vchangyi.com"
17 - domain = '6B2A70EB0A6916AB0A71D556550EA970' 17 + domain = '755DD9770A69039F18591A2906A3C371' # 企业号“小仙女”
18 18
19 19
20 mobile = '17321009308' 20 mobile = '17321009308'
21 psw = '123456' 21 psw = '123456'
22 - uid = '6B2A7F0F0A69039F559F4AA2A010BB26' 22 + jipeihong_uid = '755DE0550A69039F0BA12102F4A4F8E1' # 季培红的UID
23 cert = ('1_vchangyi.com_bundle.crt', '2_vchangyi.com.key') 23 cert = ('1_vchangyi.com_bundle.crt', '2_vchangyi.com.key')
24 24
25 header_json = {"Content-Type": "application/json; charset=utf-8"} 25 header_json = {"Content-Type": "application/json; charset=utf-8"}
atdd/PcPost.py
@@ -10,7 +10,7 @@ class PcPost(ATDDCase): @@ -10,7 +10,7 @@ class PcPost(ATDDCase):
10 result = data['result'] 10 result = data['result']
11 11
12 if isinstance(result, list): 12 if isinstance(result, list):
13 - user = result[0] 13 + user = result[1]
14 if len(result) > 1: 14 if len(result) > 1:
15 print("选择企业:", user['enterpriseInfo']['epName']) 15 print("选择企业:", user['enterpriseInfo']['epName'])
16 16
@@ -73,10 +73,10 @@ class PcPost(ATDDCase): @@ -73,10 +73,10 @@ class PcPost(ATDDCase):
73 73
74 url = self.host + '/' + self.domain + self.interfaceUrl 74 url = self.host + '/' + self.domain + self.interfaceUrl
75 r = self.post(url, self.data, **options) 75 r = self.post(url, self.data, **options)
76 - self.assertEquals(200, r.status_code) 76 + self.assertEqual(200, r.status_code)
77 result = json.loads(r.text) 77 result = json.loads(r.text)
78 errcode = result['errcode'] 78 errcode = result['errcode']
79 - self.assertEquals(0, errcode) 79 + self.assertEqual(0, errcode)
80 return result 80 return result
81 81
82 # 后端接口模板-异常判断 82 # 后端接口模板-异常判断
@@ -87,8 +87,8 @@ class PcPost(ATDDCase): @@ -87,8 +87,8 @@ class PcPost(ATDDCase):
87 87
88 url = self.host + '/' + self.domain + self.interfaceUrl 88 url = self.host + '/' + self.domain + self.interfaceUrl
89 r = self.post(url, self.data, **options) 89 r = self.post(url, self.data, **options)
90 - self.assertEquals(200, r.status_code) 90 + self.assertEqual(200, r.status_code)
91 result = json.loads(r.text) 91 result = json.loads(r.text)
92 errcode = result['errcode'] 92 errcode = result['errcode']
93 - self.assertEquals(code, errcode) 93 + self.assertEqual(code, errcode)
94 return result 94 return result
95 \ No newline at end of file 95 \ No newline at end of file
atdd/__pycache__/ATDDCase.cpython-36.pyc 0 → 100644
No preview for this file type
atdd/__pycache__/PcPost.cpython-36.pyc 0 → 100644
No preview for this file type
tests/Staff_Management/AdminSettings/public_adminSettings.py 0 → 100644
  1 +
  2 +from atdd.PcPost import PcPost
  3 +
tests/Staff_Management/AdminSettings/test_jobSetting.py 0 → 100644
  1 +from atdd.PcPost import PcPost
  2 +
  3 +class JobSetting(PcPost):
  4 + def setUp(self):
  5 + self.do_login(self.host, self.mobile, self.psw, self.domain)
  6 +
  7 + # 岗位list——岗位管理页面
  8 + def test_getJobList(self):
  9 + interfaceUrl = "/Contact/Apicp/Job/List"
  10 + data = {
  11 + "page": 1,
  12 + "limit": 10
  13 + }
  14 + result = self.PcPost(interfaceUrl,data)
  15 + return result
  16 +
  17 + # 获取所有岗位的ID,以list格式返回
  18 + def get_all_jobId(self):
  19 + jobList = self.test_getJobList()['result']['list']
  20 + jobIdList = []
  21 + for i in range(len(jobList)):
  22 + jobId = jobList[i]['jobId'].split()
  23 + # 将jobId加入到jobIdList中
  24 + jobIdList[len(jobIdList):len(jobIdList)] = jobId
  25 + return jobIdList
  26 +
  27 + # 根据岗位名称获取岗位ID
  28 + def getJobID(self, jobName):
  29 + jobList = self.test_getJobList()['result']['list']
  30 + for i in range(len(jobList)):
  31 + if (jobList[i]['jobName'] == jobName):
  32 + jobId = jobList[i]['jobId']
  33 + else:
  34 + jobId = None
  35 + return jobId
  36 +
tests/Staff_Management/AdminSettings/test_roleSetting.py 0 → 100644
  1 +from atdd.PcPost import PcPost
  2 +
  3 +class RoleSetting(PcPost):
  4 + def setUp(self):
  5 + self.do_login(self.host, self.mobile, self.psw, self.domain)
  6 +
  7 + # 角色list——角色管理页面
  8 + def test_getRoleList(self):
  9 + interfaceUrl = "/Contact/Apicp/Role/List"
  10 + data = {
  11 + "page": 1,
  12 + "limit": 10
  13 + }
  14 + result = self.PcPost(interfaceUrl,data)
  15 + return result
  16 +
  17 + # 获取所有角色的ID,以list格式返回
  18 + def get_all_roleId(self):
  19 + roleList = self.test_getRoleList()['result']['list']
  20 + roleIdList = []
  21 + for i in range(len(roleList)):
  22 + jobId = roleList[i]['roleId'].split()
  23 + # 将jobId加入到jobIdList中
  24 + roleIdList[len(roleIdList):len(roleIdList)] = jobId
  25 + return roleIdList
  26 +
  27 + # 根据角色名称获取角色ID
  28 + def getRoleID(self, roleName):
  29 + roleList = self.test_getRoleList()['result']['list']
  30 + for i in range(len(roleList)):
  31 + if (roleList[i]['roleName'] == roleName):
  32 + roleId = roleList[i]['roleId']
  33 + else:
  34 + roleId = None
  35 + return roleId
  36 +
tests/Staff_Management/Invite/test_InvitationLetters.py 0 → 100644
  1 +from atdd.PcPost import PcPost
  2 +
  3 +class InvitationLetter(PcPost):
  4 +
  5 + interfaceUrl = "/contact/Apicp/Invite/Save"
  6 +
  7 + def setUp(self):
  8 + self.do_login(self.host, self.mobile, self.psw, self.domain)
  9 +
  10 + def test_invitationLetter(self):
  11 + data = {
  12 + "content": "<p>欢迎加入【小仙女】!</p><p>这里是学习成长赋能新平台,深度整合公司资料、知识、技能、能力测评以及各种好"
  13 + "玩的活动和服务,真正帮助大家达到能力提升、快速高效提高工作效能。</p><p>大家可以通过碎片化时间随时随地参与"
  14 + "学习各种新知识、技能,了解公司新动态,公司构建平台的目的是希望同事们可以互动沟通,人人学习、人人分享,大家"
  15 + "一起享受企业赋能的无限可能。</p><p>打通员工、公司总部、培训管理之间的时空距离,提升大家学习成长体验,打造"
  16 + "不一样的共同成长氛围。333</p>",
  17 + "share_content": "点击链接加入“【小仙女】”,一起享受企业赋能之旅吧。222"
  18 + }
  19 + result = self.PcPost(self.interfaceUrl,data)
  20 + return result
  21 +
  22 +
tests/Staff_Management/Invite/test_Invitation_authority.py 0 → 100644
  1 +from atdd.PcPost import PcPost
  2 +from tests.Staff_Management.AdminSettings.test_jobSetting import JobSetting
  3 +from tests.Staff_Management.AdminSettings.test_roleSetting import RoleSetting
  4 +import random
  5 +
  6 +class InvitationAuth(PcPost):
  7 +
  8 + interfaceUrl = "/Public/Apicp/ChooseMem/ConfirmChoose"
  9 +
  10 + def setUp(self):
  11 + self.do_login(self.host, self.mobile, self.psw, self.domain)
  12 +
  13 + # 选择成员
  14 + def test_invitationauth_mem(self):
  15 + data = {
  16 + "_identifier": "yuanquan",
  17 + "memArray[0][memID]": self.jipeihong_uid
  18 + }
  19 + result = self.PcPost(self.interfaceUrl,data)
  20 + print(result)
  21 + return result
  22 +
  23 + # 选择岗位
  24 + def test_invitationauth_job(self):
  25 + jobIdList = JobSetting().get_all_jobId()
  26 + x = random.randint(0,len(jobIdList)-1)
  27 + data = {
  28 + "_identifier": "yuanquan",
  29 + "jobArray[0][jobID]": jobIdList[x]
  30 + }
  31 + result = self.PcPost(self.interfaceUrl,data)
  32 + print(result)
  33 + return result
  34 +
  35 + # 选择角色
  36 + def test_invitationauth_role(self):
  37 + roleIdList = RoleSetting().get_all_roleId()
  38 + x = random.randint(0,len(roleIdList)-1)
  39 + data = {
  40 + "_identifier": "yuanquan",
  41 + "roleArray[0][roleID]": roleIdList[x]
  42 + }
  43 + result = self.PcPost(self.interfaceUrl,data)
  44 + print(result)
  45 + return result
  46 +
tests/Staff_Management/MemberList/test_delete_mem.py 0 → 100644
  1 +import unittest
  2 +from atdd.PcPost import PcPost
  3 +
  4 +
  5 +class DeleteMem(PcPost):
  6 + def setUp(self):
  7 + self.do_login(self.host, self.mobile, self.psw, self.domain)
  8 +
  9 + def test_delete_mem(self):
  10 + url = ''
  11 +
  12 +
  13 +if __name__ == '__main__':
  14 + unittest.main()
tests/Staff_Management/MemberList/test_detail_mem.py 0 → 100644
  1 +import unittest
  2 +from atdd.PcPost import PcPost
  3 +
  4 +
  5 +class MemDetail(PcPost):
  6 + def setUp(self):
  7 + self.do_login(self.host, self.mobile, self.psw, self.domain)
  8 +
  9 + # 返回新增员工字段信息接口
  10 + def test_memdetail(self):
  11 + url = '/contact/Apicp/User/AttributeInfo'
  12 + data = {
  13 + }
  14 + result = self.PcPost(url, data)
  15 + print('接口地址:' + self.host + self.domain + url)
  16 + self.assertEqual('ok', result['errmsg'], msg=result['errmsg']) # limit判断? 判断通过打印?
  17 + # print(result)
  18 +
  19 +if __name__ == '__main__':
  20 + unittest.main()
tests/Staff_Management/MemberList/test_memlist_mem.py 0 → 100644
  1 +# Author: liuyang 2017年11月7日16:43:08
  2 +
  3 +from atdd.PcPost import PcPost
  4 +
  5 +
  6 +class ReadMemList(PcPost):
  7 + def setUp(self):
  8 + self.do_login(self.host, self.mobile, self.psw, self.domain)
  9 +
  10 + def test_memlist(self):
  11 + url = "/contact/Apicp/User/DepartmentMember"
  12 + data = {
  13 + }
  14 + result = self.PcPost(url, data)
  15 + print(self.host + '/' + self.domain + url)
  16 + self.assertEqual("ok", result["errmsg"], msg=result["errmsg"]) # 怎样断言返回结果中的limit(动态)数据?
  17 + print(result)
  18 + return result
tests/Staff_Management/MemberList/test_memuid_list.py 0 → 100644
  1 +import unittest
  2 +from atdd.PcPost import PcPost
  3 +
  4 +
  5 +class Memuid(PcPost):
  6 + def setUp(self):
  7 + self.do_login(self.host, self.mobile, self.psw, self.domain)
  8 +
  9 + # 员工列表接口
  10 + def test_memlist(self):
  11 + url = '/contact/Apicp/User/DepartmentMember'
  12 + data = {
  13 + }
  14 + result = self.PcPost(url, data)
  15 + print('接口地址:' + self.host + self.domain + url)
  16 + self.assertEqual('ok', result['errmsg'], msg=result['errmsg'])
  17 + list = result['result']['list']
  18 + memberList = []
  19 + for i in range(len(list)):
  20 + mem_Uid = result['result']['list'][i]['uid'].split()
  21 + memberList[len(memberList):len(memberList)] = mem_Uid
  22 + print(memberList)
  23 + return memberList
  24 +
  25 +if __name__ == '__main__':
  26 + unittest.main()
tests/Staff_Management/MemberList/test_roleId_jobid.py 0 → 100644
  1 +import unittest
  2 +from atdd.PcPost import PcPost
  3 +
  4 +
  5 +class RoleId(PcPost):
  6 + def setUp(self):
  7 + self.do_login(self.host, self.mobile, self.psw, self.domain)
  8 +
  9 + # 获取角色列表
  10 + def test_get_roleid(self):
  11 + url = '/Contact/Apicp/Role/List'
  12 + data = {
  13 + }
  14 + result = self.PcPost(url, data)
  15 + print('接口地址: ' + self.host + self.domain + url)
  16 + list = result['result']['list']
  17 + roleidlist = []
  18 + for i in range(len(list)):
  19 + roleId = result['result']['list'][i]['roleId'].split()
  20 + roleidlist[len(roleidlist):len(roleidlist)] = roleId
  21 + print(roleidlist)
  22 + return roleidlist
  23 +
  24 + # 获取岗位列表
  25 + def test_get_jobid(self):
  26 + url = '/Contact/Apicp/Job/List'
  27 + data = {
  28 + }
  29 + result = self.PcPost(url, data)
  30 + resultlist = result['result']['list']
  31 + jobIdlist = []
  32 + for i in range(len(resultlist)):
  33 + jobId = result['result']['list'][i][jobId].split()
  34 +
  35 +
  36 +if __name__ == '__main__':
  37 + unittest.main()
tests/Staff_Management/MemberList/test_save_mem.py 0 → 100644
  1 +import unittest
  2 +from atdd.PcPost import PcPost
  3 +
  4 +
  5 +class SaveMem(PcPost):
  6 + def setUp(self):
  7 + self.do_login(self.host, self.mobile, self.psw, self.domain)
  8 +
  9 + def test_add_mem(self):
  10 + url = '/contact/Apicp/User/Save'
  11 + data = {
  12 + 'field_name': 'api-boy',
  13 + 'memGender': 2,
  14 + 'memMobile': '13818801801',
  15 + 'memEmail': '13818801801@163.com',
  16 + 'dpName': '755DDF7E0A69039F0BA121026E5D4D00',
  17 + 'memJob': '755DDF0C0A6916AB3CE15C27CE2D41BB',
  18 + 'memRole': '755DE1790A692CB94314A8BA1FEC458A' # 管理者
  19 + }
  20 + result = self.PcPost(url, data)
  21 + print(self.host + '/' + self.domain + url)
  22 + print(result)
  23 + return result
  24 +
  25 +if __name__ == '__main__':
  26 + unittest.main()
tests/Staff_Management/MemberList/test_search_mem.py 0 → 100644
  1 +import unittest
  2 +from atdd.PcPost import PcPost
  3 +
  4 +
  5 +class SearchMem(PcPost):
  6 +
  7 + def setUp(self):
  8 + self.do_login(self.host, self.mobile, self.psw, self.domain)
  9 +
  10 + # 全部列表
  11 + def test_search_mem(self):
  12 + url = '/contact/Apicp/User/DepartmentMember'
  13 + data = {
  14 + }
  15 + result = self.PcPost(url, data)
  16 + print('接口地址:' + self.host + '/' + self.domain + url)
  17 + # print(result)
  18 + return result
  19 +
  20 + # 按姓名搜索
  21 + def test_search_name(self):
  22 + url = '/contact/Apicp/User/DepartmentMember'
  23 + data = {
  24 + 'name': '刘洋'
  25 + }
  26 + result = self.PcPost(url, data)
  27 + type(result)
  28 + print('接口地址: ' + self.host + '/' + self.domain + url)
  29 + self.assertEqual(0, result['errcode'], msg=result['errcode'])
  30 + # self.assertEqual('ok', result['errsdkcode'], msg=result['errsdkcode']) # 怎样断言返回结果中的limit(动态)数据?
  31 + return result
  32 +
  33 + # 按手机号搜索
  34 + def test_search_mobile(self):
  35 + url = '/contact/Apicp/User/DepartmentMember'
  36 + data = {
  37 + 'mobile': 13818801804
  38 + }
  39 + result = self.PcPost(url, data)
  40 + print('接口地址:' + self.host + '/' + self.domain + url)
  41 + self.assertEqual(0, result['errcode'], msg=result['errcode'])
  42 + return result
  43 +
  44 + # 按角色搜索
  45 + def test_search_role(self):
  46 + url = '/contact/Apicp/User/DepartmentMember'
  47 + data = {
  48 + 'role_ids[0]': '755DE1EC0A69039F18591A299B47E6F3' # 需动态获取角色列表数据作为参数读取
  49 + }
  50 + result = self.PcPost(url, data)
  51 + self.assertEqual(0, result['errcode'], msg=result['errcode'])
  52 + print(result) # 返回结果待验证?
  53 + return result
  54 +
  55 +
  56 +if __name__ == '__main__':
  57 + unittest.main()
tests/Staff_Management/Organization/public_org.py 0 → 100644
  1 +
  2 +from atdd.PcPost import PcPost
  3 +
  4 +class PulbicOrg(PcPost):
  5 + url_ListChildren = "/Contact/Apicp/Department/ListChildren"
  6 +
  7 + # 获取顶级部门的ID
  8 + def get_top_org(self):
  9 + url = "/Contact/Apicp/Department/List"
  10 + data = {
  11 + "_identifier": 'contact',
  12 + "limit": 99999
  13 + }
  14 + result = self.PcPost(url,data)
  15 + top_dpId = result['result']['list'][0]['dpId']
  16 + return top_dpId
  17 +
  18 + # 查找某一个部门以及其子部门的dpId,以list格式返回
  19 + def get_all_dpId(self,dpParentId):
  20 + data = {
  21 + "dpParentId":dpParentId
  22 + }
  23 + result = self.PcPost(self.url_ListChildren,data)
  24 + orglist = result['result']['list'] # 组织列表的list信息
  25 + dpIdList = []
  26 + for i in range(len(orglist)):
  27 + dpId = orglist[i]['dpId'].split()
  28 + # 将dpId加入到dpIdList中
  29 + dpIdList[len(dpIdList):len(dpIdList)] = dpId
  30 + return dpIdList
  31 +
  32 + # 获取组织下的人员总数
  33 + def get_org_user_total(self,dpParentId):
  34 + data = {
  35 + "dpParentId": dpParentId
  36 + }
  37 + result = self.PcPost(self.url_ListChildren,data)
  38 + user_total = result['result']['list'][0]['user_total']
  39 + return user_total
  40 +
  41 +
  42 +
  43 +
  44 +
  45 +
tests/Staff_Management/Organization/test_DepartmentMember.py 0 → 100644
  1 +from atdd.PcPost import PcPost
  2 +from tests.Staff_Management.Organization.public_org import PulbicOrg
  3 +import random
  4 +
  5 +# 点击组织,跳转至人员列表页面,即查询该组织下的人员情况
  6 +class DepartmentMember(PcPost):
  7 +
  8 + interfaceUrl = "/contact/Apicp/User/DepartmentMember"
  9 +
  10 + def setUp(self):
  11 + self.do_login(self.host, self.mobile, self.psw, self.domain)
  12 +
  13 + def test_departmentMember(self):
  14 + top_Id = PulbicOrg().get_top_org()
  15 + dpId_all = PulbicOrg().get_all_dpId(top_Id) # 所有部门的dpId
  16 + x = random.randint(0, len(dpId_all) - 1) # 在所有部门中随机取一个部门
  17 + data = {
  18 + "department_id[0]": dpId_all[x]
  19 + }
  20 + result = self.PcPost(self.interfaceUrl,data)
  21 + print(result)
0 \ No newline at end of file 22 \ No newline at end of file
tests/Staff_Management/Organization/test_add_org.py 0 → 100644
  1 +# Author: jipeihong 2017年11月7日14:52:52
  2 +
  3 +from atdd.PcPost import PcPost
  4 +from tests.Staff_Management.Organization.public_org import PulbicOrg
  5 +import random
  6 +
  7 +class AddOrg(PcPost):
  8 +
  9 + interfaceUrl = "/contact/Apicp/Department/Save"
  10 +
  11 + def setUp(self):
  12 + self.do_login(self.host, self.mobile, self.psw, self.domain)
  13 +
  14 +
  15 + # 添加非门店
  16 + def test_add_org(self):
  17 + x = random.randint(0,1000)
  18 + top_dpId = PulbicOrg().get_top_org()
  19 + data = {
  20 + "department_id": None,
  21 + "parent_id": top_dpId, # 顶级部门
  22 + "dp_name": "总部组织"+ str(x),
  23 + "is_all": 1,
  24 + "is_dept": 0,
  25 + "dpt_id": "755DD9820A69039F18591A29AC42531A", # 组织类型
  26 + "dp_serial_num": 1,
  27 + "dp_leader_uids[0]": self.jipeihong_uid
  28 + }
  29 + result = self.PcPost(self.interfaceUrl,data)
  30 + print(result)
  31 + return result
  32 +
  33 + # 新增门店
  34 + def test_add_mendian(self):
  35 + x = random.randint(0,1000)
  36 + top_dpId = PulbicOrg().get_top_org()
  37 + data = {
  38 + "department_id": None,
  39 + "parent_id": top_dpId, # 顶级部门
  40 + "dp_name": "门店"+ str(x),
  41 + "is_all": 1,
  42 + "is_dept": 0,
  43 + "extList[755DD98A0A69039F18591A29234CC182]": 1,
  44 + "extList[755DD98B0A69039F18591A29737749E6]": 2,
  45 + "extList[755DD98C0A69039F18591A295933D690]": 1,
  46 + "extList[755DD98D0A69039F18591A2959748F91][province]": "山西省",
  47 + "extList[755DD98D0A69039F18591A2959748F91][city]": "晋城市",
  48 + "extList[755DD98D0A69039F18591A2959748F91][town]": "泽州县",
  49 + "extList[755DD98E0A69039F18591A2935DC27D1]": 222,
  50 + "extList[755DD98F0A69039F18591A2929431878]": 222,
  51 + "extList[755DD9900A69039F18591A298A2C8C20]": 22222,
  52 + "extList[755DD9920A69039F18591A29EFFCB47E]": 222,
  53 + "dpt_id": "755DD9880A69039F18591A294E089AC7",
  54 + "dp_serial_num": 33,
  55 + "dp_leader_uids[0]": self.jipeihong_uid
  56 + }
  57 + result = self.PcPost(self.interfaceUrl,data)
  58 + print(result)
tests/Staff_Management/Organization/test_delete_org.py 0 → 100644
  1 +# Author: jipeihong 2017年11月7日14:52:52
  2 +
  3 +from atdd.PcPost import PcPost
  4 +from tests.Staff_Management.Organization.public_org import PulbicOrg
  5 +import random
  6 +
  7 +class DeleteOrg(PcPost):
  8 +
  9 + interfaceUrl = "/contact/Apicp/Department/Delete"
  10 +
  11 + def setUp(self):
  12 + self.do_login(self.host, self.mobile, self.psw, self.domain)
  13 +
  14 + def test_delete_org(self):
  15 + top_Id = PulbicOrg().get_top_org()
  16 + dpId_all = PulbicOrg().get_all_dpId(top_Id) # 所有部门的dpId
  17 + x = random.randint(0, len(dpId_all)-1) # 在所有部门中随机取一个部门
  18 + dpIdList = PulbicOrg().get_all_dpId(dpId_all[x]) #获取该部门以及子部门的ID
  19 + user_total = PulbicOrg().get_org_user_total(dpId_all[x]) # 获取该该部门的人员总数
  20 + if len(dpIdList)>1 or user_total>0 or len(dpId_all)==1 : # 如果存在子部门或人员 或只剩下顶级部门
  21 + code = 700
  22 + data = {
  23 + "department_id": dpIdList[x]
  24 + }
  25 + result = self.PcPostAbnormal(self.interfaceUrl,data,code)
  26 + else: # 删除非顶级部门,且部门下无子部门和人员
  27 + data = {
  28 + "department_id": dpIdList[0] #顶级部门
  29 + }
  30 + result = self.PcPost(self.interfaceUrl,data)
  31 + print(result)
  32 + return result
  33 +
  34 +
  35 +
  36 +
  37 +
  38 +
tests/Staff-Management/Organization/test_search_org.py renamed to tests/Staff_Management/Organization/test_search_org.py
1 1
2 - # Author: jipeihong 2017年11月7日11:22:08 2 +# Author: jipeihong 2017年11月7日11:22:08
3 3
4 from atdd.PcPost import PcPost 4 from atdd.PcPost import PcPost
5 5
  6 +# 搜索组织
6 class SearchOrg(PcPost): 7 class SearchOrg(PcPost):
  8 +
  9 + interfaceUrl = "/contact/Apicp/Department/Search"
  10 +
7 def setUp(self): 11 def setUp(self):
8 self.do_login(self.host, self.mobile, self.psw, self.domain) 12 self.do_login(self.host, self.mobile, self.psw, self.domain)
9 13
  14 + # 搜索存在的组织
10 def test_search_org(self): 15 def test_search_org(self):
11 - interfaceUrl = "/contact/Apicp/Department/Search"  
12 data = { 16 data = {
13 "keyword": 123 17 "keyword": 123
14 } 18 }
15 - result = self.PcPost(interfaceUrl,data) 19 + result = self.PcPost(self.interfaceUrl,data)
  20 + print(result)
  21 + return result
  22 +
  23 + # 搜索不存在的组织
  24 + def test_search_org_abnormal(self):
  25 + data = {
  26 + "keyword": 12345
  27 + }
  28 + result = self.PcPost(self.interfaceUrl,data)
16 print(result) 29 print(result)
17 return result 30 return result
18 31