Commit 91261ae93ed81818d290e97904582ba6961aa2f4

Authored by 季培红
1 parent faee7d98

deleteorg

tests/Staff-Management/Organization/public_org.py deleted 100644 → 0
tests/Staff-Management/Organization/test_delete_org.py deleted 100644 → 0
1 -# Author: jipeihong 2017年11月7日14:52:52  
2 -  
3 -from atdd.PcPost import PcPost  
4 -  
5 -class DeleteOrg(PcPost):  
6 -  
7 - interfaceUrl = "/contact/Apicp/Department/Delete"  
8 -  
9 - def setUp(self):  
10 - self.do_login(self.host, self.mobile, self.psw, self.domain)  
11 -  
12 - # 查找除了顶级部门之外的所有部门的dpId  
13 - def get_all_dpId(self):  
14 - url = "/Contact/Apicp/Department/ListChildren"  
15 - data = {  
16 - "dpParentId":  
17 - }  
18 -  
19 -  
20 - def test_delete_org(self):  
21 - # data = {  
22 - # "department_id":  
23 - # }  
tests/Staff_Management/Organization/public_org.py 0 → 100644
  1 +
  2 +from atdd.PcPost import PcPost
  3 +
  4 +class PulbicOrg(PcPost):
  5 +
  6 + def get_top_org(self):
  7 + url = "/Contact/Apicp/Department/List"
  8 + data = {
  9 + "_identifier": 'contact',
  10 + "limit": 99999
  11 + }
  12 + result = self.PcPost(url,data)
  13 + top_dpId = result['result']['list'][0]['dpId']
  14 + return top_dpId
  15 +
  16 + # 查找所有部门的dpId,包括顶级部门,以list格式返回
  17 + def get_all_dpId(self):
  18 + url = "/Contact/Apicp/Department/ListChildren"
  19 + data = {
  20 + "dpParentId":self.get_top_org()
  21 + }
  22 + result = self.PcPost(url,data)
  23 + orglist = result['result']['list'] # 组织列表的list信息
  24 + dpIdList = []
  25 + for i in range(len(orglist)):
  26 + dpId = orglist[i]['dpId'].split()
  27 + # 将dpId加入到dpIdList中
  28 + dpIdList[len(dpIdList):len(dpIdList)] = dpId
  29 + return dpIdList
  30 +
  31 +
  32 +
  33 +
  34 +
tests/Staff-Management/Organization/test_add_org.py renamed to tests/Staff_Management/Organization/test_add_org.py
1 # Author: jipeihong 2017年11月7日14:52:52 1 # Author: jipeihong 2017年11月7日14:52:52
2 2
3 from atdd.PcPost import PcPost 3 from atdd.PcPost import PcPost
  4 +from tests.Staff_Management.Organization.public_org import PulbicOrg
4 import random 5 import random
5 6
6 class AddOrg(PcPost): 7 class AddOrg(PcPost):
7 8
8 -  
9 interfaceUrl = "/contact/Apicp/Department/Save" 9 interfaceUrl = "/contact/Apicp/Department/Save"
10 10
11 def setUp(self): 11 def setUp(self):
12 self.do_login(self.host, self.mobile, self.psw, self.domain) 12 self.do_login(self.host, self.mobile, self.psw, self.domain)
13 13
14 - def get_top_org(self):  
15 - url = "/Contact/Apicp/Department/List"  
16 - data = {  
17 - "_identifier": 'contact',  
18 - "limit": 99999  
19 - }  
20 - result = self.PcPost(url,data)  
21 - top_dpId = result['result']['list'][0]['dpId']  
22 - return top_dpId  
23 -  
24 -  
25 def test_add_org(self): 14 def test_add_org(self):
26 x = random.randint(0,1000) 15 x = random.randint(0,1000)
27 - top_dpId = self.get_top_org() 16 + top_dpId = PulbicOrg().get_top_org()
28 data = { 17 data = {
29 "department_id": None, 18 "department_id": None,
30 "parent_id": top_dpId, # 顶级部门 19 "parent_id": top_dpId, # 顶级部门
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 + dpIdList = PulbicOrg().get_all_dpId()
  16 + if len(dpIdList)>1:
  17 + x = random.randint(0,len(dpIdList)-2) #从第一个组织ID到倒数第二个组织ID,去掉顶级部门
  18 + data = {
  19 + "department_id": dpIdList[x]
  20 + }
  21 + result = self.PcPost(self.interfaceUrl,data)
  22 + else: # 删除顶级部门
  23 + code = 700
  24 + data = {
  25 + "department_id": dpIdList[0] #顶级部门
  26 + }
  27 + result = self.PcPostAbnormal(self.interfaceUrl,data,code)
  28 + print(result)
  29 + return result
  30 +
  31 +
  32 +
  33 +
  34 +
  35 +
tests/Staff-Management/Organization/test_search_org.py renamed to tests/Staff_Management/Organization/test_search_org.py