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_049_check_network_country_timezone(self): u"""检查group2 network的国家代码和时区""" log.debug("049") tmp = NetworkListBusiness(self.s) id = tmp.get_network_id('group2') network_country, network_timezone = tmp.get_networkitem_country_timezone( id) self.assertEqual('US', network_country) self.assertEqual("Etc/GMT", network_timezone)
def test_052_check_group2_network_uesr(self): u"""检查group2 network的网络管理员""" log.debug("052") tmp = NetworkListBusiness(self.s) id = tmp.get_network_id('group1') count, user = tmp.get_networkitem_all_user(id) self.assertEqual(2, count) self.assertIn(data_basic['cloud_user'], user) self.assertIn(data_basic['Cloud_test_user'], user)
def test_047_check_default_network_country_timezone(self): u"""检查default network的国家代码和时区(默认""" log.debug("047") tmp = NetworkListBusiness(self.s) id = tmp.get_network_id('default') network_country, network_timezone = tmp.get_networkitem_country_timezone( id) self.assertEqual('US', network_country) self.assertEqual("Etc/GMT", network_timezone)
def test_001_add_2_network_cloud(self): u"""cloud中添加两个netwrok,并且判断是否成功""" log.debug("001") tmp = APSBusiness(self.s) #描述:启用无线网卡 tmp.wlan_enable(data_basic['wlan_pc']) tmp.dhcp_release_wlan(data_basic['wlan_pc']) #获取登录名对应的id tmp1 = UserBusiness(self.s) user_id = tmp1.get_network_id(data_basic['cloud_user']) tmp2 = NetworkListBusiness(self.s) #添加2个网络组 result = tmp2.add_network("group1", user_id, "") result1 = tmp2.add_network("group2", user_id, "") #获取网络组对应的id--监控面板--网络列表 network_id = tmp2.get_network_id("group1") network_id1 = tmp2.get_network_id("group2") self.assertEqual(network_id, int(result['data']['value'])) self.assertEqual(network_id1, int(result1['data']['value']))
def test_008_delete_newNetwork(self): u"""删除新建的网络组""" log.debug("008") #删除网络组group1 tmp = NetworkListBusiness(self.s) tmp.delete_network("group1") time.sleep(60) #获取网络组对应的id--监控面板--网络列表 network_id = tmp.get_network_id("group1") self.assertEqual(network_id, None)
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_004_Platform_Administrator_add_network(self): u"""平台管理员-添加网络组""" log.debug("004") #获取登录名对应的id tmp1 =UserBusiness(self.s) #使用测试用户登录 tmp1.webLogin(data_basic['Cloud_test_user'], data_basic['Cloud_test_pwd']) user_id = tmp1.get_network_id(data_basic['Cloud_test_user']) tmp = NetworkListBusiness(self.s) #添加网络组 tmp.add_network("group1", user_id, "") time.sleep(60) #获取网络组对应的id--监控面板--网络列表 network_id = tmp.get_network_id("group1") self.assertNotEqual(network_id, None)
def test_005_remove_ap2(self): u"""移动ap-从group1移动到default""" log.debug("005") #获取default的id tmp = NetworkListBusiness(self.s) network_id = tmp.get_network_id("default") #选择进入group1网络组 tmp.goin_network("group1") #移动该ap到group1中 tmp1 = APSBusiness(self.s) tmp1.move_aps(data_ap['7600lr_mac'].upper(), network_id) time.sleep(60) #获取ap列表ap的网络组名 tmp2 = AllApListBusiness(self.s) network_name = tmp2.get_ap_info(data_ap['7600lr_mac'])['network'] self.assertEqual(network_name, "default")
def test_004_remove_ap1(self): u"""移动ap-从default移动到group1""" log.debug("004") #获取group1的id tmp = NetworkListBusiness(self.s) network_id = tmp.get_network_id("group1") #将ap复位,并将ap的hosts替换,指向本地cloud,然后将该ap添加到cloud中 tmp1 = APSBusiness(self.s) tmp1.add_ap_2_local_cloud(data_basic['7600lr_ip'], data_ap['7600lr_mac'], "autotest_7600lr") time.sleep(60) #移动该ap到group1中 tmp1.move_aps(data_ap['7600lr_mac'].upper(), network_id) time.sleep(60) #获取ap列表ap的网络组名 tmp2 = AllApListBusiness(self.s) network_name = tmp2.get_ap_info(data_ap['7600lr_mac'])['network'] self.assertEqual(network_name, "group1")
def test_001_add_network(self): u"""创建新的网络组并判断是否添加成功""" log.debug("001") #获取登录名对应的id tmp1 =UserBusiness(self.s) #描述:启用无线网卡 tmp1.wlan_enable(data_basic['wlan_pc']) tmp1.dhcp_release_wlan(data_basic['wlan_pc']) user_id = tmp1.get_network_id(data_basic['cloud_user']) tmp = NetworkListBusiness(self.s) #添加网络组 tmp.add_network("group1", user_id, "") time.sleep(60) #获取网络组对应的id--监控面板--网络列表 network_id = tmp.get_network_id("group1") self.assertNotEqual(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 test_007_remove_many_aps2(self): u"""移动多ap-从group1移动到default""" log.debug("007") #获取default的id tmp = NetworkListBusiness(self.s) network_id = tmp.get_network_id("default") #选择进入group1网络组 tmp.goin_network("group1") #移动三个ap(7600,7600lr,7610)到group1中 tmp1 = APSBusiness(self.s) tmp1.move_aps(data_ap['7600lr_mac'].upper(), network_id) tmp1.move_aps(data_ap['7600_mac'].upper(), network_id) tmp1.move_aps(data_ap['7610_mac'].upper(), network_id) time.sleep(60) #获取ap列表ap的网络组名 tmp2 = AllApListBusiness(self.s) network_name_7600lr = tmp2.get_ap_info(data_ap['7600lr_mac'])['network'] network_name_7600 = tmp2.get_ap_info(data_ap['7600_mac'])['network'] network_name_7610 = tmp2.get_ap_info(data_ap['7610_mac'])['network'] self.assertEqual(network_name_7600lr, "default") self.assertEqual(network_name_7600, "default") self.assertEqual(network_name_7610, "default")