def test_001_Platform_Administrator_add_ap(self): u"""平台管理员-能添加ap""" log.debug("001") tmp1 = NetworkListBusiness(self.s) #描述:启用无线网卡 tmp1.wlan_enable(data_basic['wlan_pc']) tmp1.dhcp_release_wlan(data_basic['wlan_pc']) #使用用户名密码,带着cookie登录cloud,并返回响应数据 tmp1.webLogin(data_basic['cloud_user'], data_basic['cloud_pwd']) #获取默认网络组default的id networkid = tmp1.get_network_id("default") time.sleep(60) tmp = UserBusiness(self.s) #修改测试用户为平台管理员 tmp.set_user_authority(data_basic['Cloud_test_user'], \ data_basic['Cloud_test_email'], "Platform Administrator", [networkid]) time.sleep(60) #admin用户退出登录 tmp.webLogout() #使用测试用户登录 tmp2 = APSBusiness(self.s) tmp2.webLogin(data_basic['Cloud_test_user'], data_basic['Cloud_test_pwd']) #添加ap-7610 #将ap复位,并将ap的hosts替换,指向本地cloud,然后将该ap添加到cloud中 tmp2.add_ap_2_local_cloud(data_basic['7610_ip'], data_ap['7610_mac'], "autotest_7610") #cloud上获取该网络组的ssh密码 tmp3 = SettingsBusiness(self.s) ssh_pwd = tmp3.get_ssh_pwd() #判断ap是否已经和cloud配对上 result = tmp2.check_ap_pair_cloud(data_basic['7610_ip'], data_basic['sshUser'], ssh_pwd) self.assertTrue(result)
def test_005_Platform_Administrator_delete_network(self): u"""平台管理员-删除网路组""" log.debug("005") #删除网络组group1 tmp = NetworkListBusiness(self.s) #使用测试用户登录 tmp.webLogin(data_basic['Cloud_test_user'], data_basic['Cloud_test_pwd']) tmp.delete_network("group1") time.sleep(60) #获取网络组对应的id--监控面板--网络列表 network_id = tmp.get_network_id("group1") self.assertEqual(network_id, None)
def test_012_Guest_Editor_add_ap(self): u"""访客管理员-不能添加ap""" log.debug("012") tmp1 = NetworkListBusiness(self.s) #使用用户名密码,带着cookie登录cloud,并返回响应数据 tmp1.webLogin(data_basic['cloud_user'], data_basic['cloud_pwd']) time.sleep(60) #获取默认网络组default的id networkid = tmp1.get_network_id("default") tmp = UserBusiness(self.s) #修改测试用户为访客管理员 tmp.set_user_authority(data_basic['Cloud_test_user'], \ data_basic['Cloud_test_email'], "Guest Editor", [networkid]) time.sleep(60) #admin用户退出登录 tmp.webLogout() #使用测试用户登录 tmp2 = APSBusiness(self.s) tmp2.webLogin(data_basic['Cloud_test_user'], data_basic['Cloud_test_pwd']) #添加ap-7610 result = tmp2.add_ap_2_local_cloud(data_basic['7610_ip'], data_ap['7610_mac'], "autotest_7610") self.assertFalse(result)
def setUp(self): self.s = requests.session() tmp = NetworkListBusiness(self.s) #使用用户名密码,带着cookie登录cloud,并返回响应数据 tmp.webLogin(data_basic['cloud_user'], data_basic['cloud_pwd'])