test_delete_org.py
971 Bytes
# Author: jipeihong 2017年11月7日14:52:52
from atdd.PcPost import PcPost
from tests.Staff_Management.Organization.public_org import PulbicOrg
import random
class DeleteOrg(PcPost):
interfaceUrl = "/contact/Apicp/Department/Delete"
def setUp(self):
self.do_login(self.host, self.mobile, self.psw, self.domain)
def test_delete_org(self):
dpIdList = PulbicOrg().get_all_dpId()
if len(dpIdList)>1:
x = random.randint(0,len(dpIdList)-2) #从第一个组织ID到倒数第二个组织ID,去掉顶级部门
data = {
"department_id": dpIdList[x]
}
result = self.PcPost(self.interfaceUrl,data)
else: # 删除顶级部门
code = 700
data = {
"department_id": dpIdList[0] #顶级部门
}
result = self.PcPostAbnormal(self.interfaceUrl,data,code)
print(result)
return result