def get_Global_Blacklist_mac(self): #点击客户端菜单 tmp = ClientsBusiness(self.driver) tmp.clients_menu() #点击客户端访问菜单 ClientAccessControl.clientaccess_menu(self) result = ClientAccessControl.get_Global_Blacklist(self) return result
def get_access_list1_mac(self): #点击客户端菜单 tmp = ClientsBusiness(self.driver) tmp.clients_menu() #点击客户端访问菜单 ClientAccessControl.clientaccess_menu(self) result = ClientAccessControl.get_Access_List1(self) return result
def del_all_timepolicy(self): #点击客户端菜单 tmp = ClientsBusiness(self.driver) tmp.clients_menu() #点击时间策略菜单 TimePolicyControl.timepolicy_menu(self) #依次点击所有组的删除按钮 TimePolicyControl.del_all_button(self) TimePolicyControl.apply(self)
def del_firest_list(self): #点击客户端菜单 tmp = ClientsBusiness(self.driver) tmp.clients_menu() #点击客户端访问菜单 ClientAccessControl.clientaccess_menu(self) ClientAccessControl.del_first_button(self) #弹出的提示窗口中,点击确认 ClientAccessControl.notice_ok(self) #弹出窗口中,点击应用 ClientAccessControl.apply(self)
def del_Access_list_n(self, name): #点击客户端菜单 tmp = ClientsBusiness(self.driver) tmp.clients_menu() #点击客户端访问菜单 ClientAccessControl.clientaccess_menu(self) #删除对应的access list ClientAccessControl.del_access_list_n(self, name) #弹出的提示窗口中,点击确认 ClientAccessControl.notice_ok(self) #弹出窗口中,点击应用 ClientAccessControl.apply(self)
def enable_disable_timepolicy(self, n): #点击客户端菜单 tmp = ClientsBusiness(self.driver) tmp.clients_menu() #点击时间策略菜单 TimePolicyControl.timepolicy_menu(self) #点击编辑按钮 TimePolicyControl.edit_button(self, n) #点击开启或关闭 TimePolicyControl.click_enable_disable(self, n) #点击保存 TimePolicyControl.click_save(self) TimePolicyControl.apply(self)
def unblock_clients(self, n): #点击客户端菜单 tmp = ClientsBusiness(self.driver) tmp.clients_menu() #点击时间策略菜单 BannedClientsControl.bannedclients_menu(self) try: #点击解锁按钮 BannedClientsControl.unblock_button(self, n) #弹出的提示窗口中,点击确认 BannedClientsControl.notice_ok(self) except: pass
def get_bannedclients_title(self): #刷新页面重新登录ap页面 Lg = LoginBusiness(self.driver) Lg.refresh_login_ap() #点击客户端菜单 tmp = ClientsBusiness(self.driver) tmp.clients_menu() #点击时间策略菜单 BannedClientsControl.bannedclients_menu(self) #获取页面所有标题 result = BannedClientsControl.get_titlediv(self) print result return result
def test_004_check_ip(self): u"""IP地址信息核对(testlink_ID:489)--bug78714""" log.debug("004") tmp = ClientsBusiness(self.driver) #点击客户端菜单 tmp.clients_menu() #获取第一个客户端的IP地址 wlan_mac = tmp.get_wlan_mac(data_basic['wlan_pc']) result = tmp.get_client_IP(wlan_mac) print "client ip on Client page is " + result tmp.dhcp_release_wlan(data_basic['wlan_pc']) assert result != "", "Check IP address on client page,test fail!" print "Check IP address on client page,test pass!"
def test_007_check_AP_mac(self): u"""AP的mac地址信息核对(testlink_ID:492)""" log.debug("007") tmp = ClientsBusiness(self.driver) #点击客户端菜单 tmp.clients_menu() #获取客户端所连接的AP名称或mac wlan_mac = tmp.get_wlan_mac(data_basic['wlan_pc']) result = tmp.get_AP_name(wlan_mac) MasterAP = data_AP['master:mac'].upper() print result, MasterAP assert result == MasterAP, "Check AP mac,test fail!" print "Check AP mac,test pass!"
def test_003_check_connected_info(self): u"""连接方式(无线)信息核对(testlink_ID:488)""" log.debug("003") tmp = ClientsBusiness(self.driver) #点击客户端菜单 tmp.clients_menu() #获取第一个客户端的类型 wlan_mac = tmp.get_wlan_mac(data_basic['wlan_pc']) result = tmp.get_cient_type(wlan_mac) assert result == ( u"无线" or "Wireless"), "Check wireless connected type info,test fail!" print "Check wireless connected type info,test pass!"
def change_timeout_hourly(self, n): #点击客户端菜单 tmp = ClientsBusiness(self.driver) tmp.clients_menu() #点击时间策略菜单 TimePolicyControl.timepolicy_menu(self) #点击编辑按钮 TimePolicyControl.edit_button(self, n) #设置客户端重连超时类型 TimePolicyControl.set_reconnect_type(self, n, "hourly") #点击保存 TimePolicyControl.click_save(self) TimePolicyControl.apply(self)
def del_Global_Blacklist_mac(self): #点击客户端菜单 tmp = ClientsBusiness(self.driver) tmp.clients_menu() #点击客户端访问菜单 ClientAccessControl.clientaccess_menu(self) #编辑Global Blacklist ClientAccessControl.edit_Global_Blacklist_button(self) #添加窗口,一直点击-号,删除所有的mac,不保留第一个mac地址 ClientAccessControl.del_all_addmac_backup(self) #点击保存 ClientAccessControl.save(self) #弹出窗口中,点击应用 ClientAccessControl.apply(self)
def del_accesslist_n_manymac(self, name): #点击客户端菜单 tmp = ClientsBusiness(self.driver) tmp.clients_menu() #点击客户端访问菜单 ClientAccessControl.clientaccess_menu(self) #编辑对应的access list ClientAccessControl.edit_access_list_n(self, name) #添加窗口,一直点击-号,删除所有的mac,只保留第一个mac地址 ClientAccessControl.del_all_addmac(self) #点击保存 ClientAccessControl.save(self) #弹出窗口中,点击应用 ClientAccessControl.apply(self)
def del_accesslist_manymac(self): #点击客户端菜单 tmp = ClientsBusiness(self.driver) tmp.clients_menu() #点击客户端访问菜单 ClientAccessControl.clientaccess_menu(self) #只有一个新增访问列表时,点击编辑 ClientAccessControl.edit_button(self) #添加窗口,一直点击-号,删除所有的mac,只保留第一个mac地址 ClientAccessControl.del_all_addmac(self) #点击保存 ClientAccessControl.save(self) #弹出窗口中,点击应用 ClientAccessControl.apply(self)
def test_039_failover_master_check_client_num(self): u"""failover ap 切换到master ap模式后,客户端数目不会改变(testlink_ID:2394)""" log.debug("039") tmp = APSBusiness(self.driver) #登录failover ap的web界面 tmp.login_failover_ap(data_basic['slave_web2'], data_basic['superUser'], data_login['all']) tmp1 = ClientsBusiness(self.driver) #点击客户端菜单 tmp1.clients_menu() #获取客户端的数量 result = tmp1.get_clients_num() self.assertEqual(1, result), "after failover change to master check client number, test fail!" print "after failover change to master check client number, test pass!"
def test_016_check_Clients_webpage(self): u"""Client数量和状态必须与客户端页面的信息一致(testlink_ID:1160)""" log.debug("016") tmp = OVBusiness(self.driver) #获取2.4G客户端数 result1 = tmp.get_2g4_client() #获取5G客户端数 result2 = tmp.get_5g_client() result = (int(result1)+int(result2)) tmp1 = ClientsBusiness(self.driver) tmp1.clients_menu() num = tmp1.get_clients_num() assert result == num,"check client number is different as Clients webpage,test fail!" print "check client number is same as Clients webpage,test pass!"
def test_005_check_connected_time(self): u"""连接时间信息核对--15s更新一次(testlink_ID:490)""" log.debug("005") tmp = ClientsBusiness(self.driver) #点击客户端菜单 tmp.clients_menu() self.driver.refresh() #获取第一个客户端的连接时间 wlan_mac = tmp.get_wlan_mac(data_basic['wlan_pc']) result1 = tmp.get_client_time(wlan_mac) time.sleep(16) result2 = tmp.get_client_time(wlan_mac) assert result1 != result2, "Check updated time on client page,test fail!" print "Check updated time on client page,test pass!"
def edit_accesslist_onemac(self, mac): #点击客户端菜单 tmp = ClientsBusiness(self.driver) tmp.clients_menu() #点击客户端访问菜单 ClientAccessControl.clientaccess_menu(self) #只有一个新增访问列表时,点击编辑 ClientAccessControl.edit_button(self) #在添加窗口输入一个mac地址 ClientAccessControl.set_mac(self, mac) #点击保存 ClientAccessControl.save(self) #弹出窗口中,点击应用 ClientAccessControl.apply(self)
def change_list_name(self, name1, name2): #点击客户端菜单 tmp = ClientsBusiness(self.driver) tmp.clients_menu() #点击客户端访问菜单 ClientAccessControl.clientaccess_menu(self) #编辑对应的access list ClientAccessControl.edit_access_list_n(self, name1) #修改list的名称 ClientAccessControl.set_list_name(self, name2) #点击保存 ClientAccessControl.save(self) #弹出窗口中,点击应用 ClientAccessControl.apply(self)
def edit_accesslist_manymac(self, n): #点击客户端菜单 tmp = ClientsBusiness(self.driver) tmp.clients_menu() #点击客户端访问菜单 ClientAccessControl.clientaccess_menu(self) #只有一个新增访问列表时,点击编辑 ClientAccessControl.edit_button(self) for i in range(n): #添加窗口,点击+号,输入一个mac地址 ClientAccessControl.set_add_addmac(self) #点击保存 ClientAccessControl.save(self) #弹出窗口中,点击应用 ClientAccessControl.apply(self)
def edit_accesslist_n_onemac(self, name, mac): #点击客户端菜单 tmp = ClientsBusiness(self.driver) tmp.clients_menu() #点击客户端访问菜单 ClientAccessControl.clientaccess_menu(self) #编辑对应的access list ClientAccessControl.edit_access_list_n(self, name) #在添加窗口输入一个mac地址 ClientAccessControl.set_mac(self, mac) #点击保存 ClientAccessControl.save(self) #弹出窗口中,点击应用 ClientAccessControl.apply(self) print "edit access list:%s successfully!" % name
def check_del_first_list(self): #点击客户端菜单 tmp = ClientsBusiness(self.driver) tmp.clients_menu() #点击客户端访问菜单 ClientAccessControl.clientaccess_menu(self) ClientAccessControl.del_first_button(self) # #弹出的提示窗口中,点击确认 # ClientAccessControl.notice_ok(self) #判断是否会弹出提示框,有则返回True,没有则返回False element = self.driver.find_element_by_xpath( ".//div[@class='modal-footer']//button[@class='btn btn-primary']") result = element.is_displayed() print result return result
def edit_accesslist_n_manymac(self, name, n): #点击客户端菜单 tmp = ClientsBusiness(self.driver) tmp.clients_menu() #点击客户端访问菜单 ClientAccessControl.clientaccess_menu(self) #编辑对应的access list ClientAccessControl.edit_access_list_n(self, name) for i in range(n): #添加窗口,点击+号,输入一个mac地址 ClientAccessControl.set_add_addmac(self) #点击保存 ClientAccessControl.save(self) #弹出窗口中,点击应用 ClientAccessControl.apply(self)
def check_block_client(self, mac, host, user, pwd): #点击客户端菜单 tmp = ClientsBusiness(self.driver) tmp.clients_menu() tmp.block_client(mac) # #获取客户端的离线状态 # result1 = tmp.get_offline_status(mac) #获取Global Blacklist的mac地址 result2 = ClientAccessBusiness.get_Global_Blacklist_mac(self) ssh = SSH(host, pwd) result3 = ssh.ssh_cmd(user, "iptables -nvL") if (mac.upper() in result2) and (mac not in result3): return True else: return False
def check_global_blacklist_default(self): #点击客户端菜单 tmp = ClientsBusiness(self.driver) tmp.clients_menu() #点击客户端访问菜单 ClientAccessControl.clientaccess_menu(self) #检查默认Global Blacklist的默认列表 result1 = ClientAccessControl.get_Global_Blacklist(self) #获取Global Blacklist的删除的显示状态 result2 = ClientAccessControl.get_global_del_button_status(self) #编辑Global Blacklist ClientAccessControl.edit_Global_Blacklist_button(self) #获取Global Blacklist的名称的显示状态 result3 = ClientAccessControl.get_global_name_status(self) print result1, result2, result3 return result1, result2, result3
def change_timeout_weekly(self, n, text, t_out): #点击客户端菜单 tmp = ClientsBusiness(self.driver) tmp.clients_menu() #点击时间策略菜单 TimePolicyControl.timepolicy_menu(self) #点击编辑按钮 TimePolicyControl.edit_button(self, n) #设置客户端重连超时类型 TimePolicyControl.set_reconnect_type(self, n, "weekly") #设置每周的第几天 TimePolicyControl.set_reset_day(self, n, text) #设置每天的第几小时重连 TimePolicyControl.set_reset_hour(self, n, t_out) #点击保存 TimePolicyControl.click_save(self) TimePolicyControl.apply(self)
def check_timeout_weekly_reset_hour_invalid(self, n, t_outs): result = [] #点击客户端菜单 tmp = ClientsBusiness(self.driver) tmp.clients_menu() #点击时间策略菜单 TimePolicyControl.timepolicy_menu(self) #点击编辑按钮 TimePolicyControl.edit_button(self, n) for t_out in t_outs: #设置每天的第几小时重连 TimePolicyControl.set_reset_hour(self, n, t_out) #判断页面上提示信息是否正确 tmp = TimePolicyControl.check_error(self, u"必须是一个0到23的整数") result.append(tmp) print result return result
def change_timeout_timed(self, n, value, unit): #点击客户端菜单 tmp = ClientsBusiness(self.driver) tmp.clients_menu() #点击时间策略菜单 TimePolicyControl.timepolicy_menu(self) #点击编辑按钮 TimePolicyControl.edit_button(self, n) #设置客户端重连超时类型 TimePolicyControl.set_reconnect_type(self, n, "timed") #设置客户端重连超时 TimePolicyControl.set_connection_timeout(self, n, value) #设置客户端重连超时的单位 TimePolicyControl.set_connection_timeout_unit(self, unit) #点击保存 TimePolicyControl.click_save(self) TimePolicyControl.apply(self)
def check_edit_timeout_timed_tip(self, n, value, unit, text): #点击客户端菜单 tmp = ClientsBusiness(self.driver) tmp.clients_menu() #点击时间策略菜单 TimePolicyControl.timepolicy_menu(self) #点击编辑按钮 TimePolicyControl.edit_button(self, n) #设置客户端重连超时类型 TimePolicyControl.set_reconnect_type(self, n, "timed") #设置客户端重连超时 TimePolicyControl.set_connection_timeout(self, n, value) #设置客户端重连超时的单位 TimePolicyControl.set_connection_timeout_unit(self, unit) #判断页面上提示信息是否正确 result = TimePolicyControl.check_error(self, text) return result