def test_025_check_timeout_hourly(self): u"""Timeout Type选择Reset Hourly(testlink_ID:3191)""" log.debug("025") tmp = TimePolicyBusiness(self.driver) #按照默认配置,新建一个时间策略 tmp.new_timepolicy_default(0, u"时间策略1", "1", "1", "h") #编辑一个时间策略,修改客户端重连超时类型为每小时 tmp.change_timeout_hourly(0) result = tmp.get_titlediv() tmp.del_all_timepolicy() self.assertIn(u"每小时", result), "check timeout is hourly, test fail!" print "check timeout is hourly, test pass!"
def test_045_check_webUI_change_config(self): u"""修改配置之后检查页面信息(testlink_ID:3201)""" log.debug("045") tmp = TimePolicyBusiness(self.driver) #修改客户端重连超时类型为每小时 tmp.change_timeout_hourly(0) #获取页面所有标题 result1 = tmp.get_titlediv() #判断页面上是否有Enable图标 result2 = tmp.check_enbale_timepolicy() #删除所有的时间策略 tmp.del_all_timepolicy() self.assertIn(u"时间策略1", result1) self.assertIn(u"每小时", result1) self.assertTrue(result2), "check time policy webUI after change config, test fail!" print "check time policy webUI after change config, test pass!"
def test_050_check_timeout_reconnection_hourly_function(self): u"""Timeout type选择reset hourly测试(testlink_ID:3205)""" log.debug("050") tmp2 = BannedClientsBusiness(self.driver) #断开网线网卡的连接 tmp2.disconnect_ap() tmp = TimePolicyBusiness(self.driver) #按照默认配置,编辑一个时间策略-5分钟,每天23点超时 tmp.edit_timepolicy_default(0, u"时间策略1", "5", "23", "m") #再编辑默认时间策略,修改客户端重连超时类型为每小时 tmp.change_timeout_hourly(0) #无线网卡连接 #先修改ap的系统时间为22:00:00 ssh = SSH(data_basic['DUT_ip'], data_login['all']) ssh.ssh_cmd(data_basic['sshUser'], "date -s 22:00:00") tmp.connect_DHCP_WPA_AP(data_wireless['all_ssid'], data_wireless['short_wpa'], data_basic['wlan_pc']) #等待6分钟 time.sleep(360) #判断AP是否依然连接 result1 = subprocess.check_output("iw dev %s link"%data_basic['wlan_pc'], shell=True) #释放无线网卡的ip tmp2.dhcp_release_wlan(data_basic['wlan_pc']) #获取禁止的客户端页面所有标题 tmp2 = BannedClientsBusiness(self.driver) result2 = tmp2.get_bannedclients_title() wlan_mac = tmp2.get_wlan_mac(data_basic['wlan_pc']).upper() #再修改ap的系统时间为22:59:00 ssh = SSH(data_basic['DUT_ip'], data_login['all']) ssh.ssh_cmd(data_basic['sshUser'], "date -s 22:59:00") #等待3分钟 time.sleep(180) #无线网卡连接 result3 = tmp.connect_DHCP_WPA_AP(data_wireless['all_ssid'], data_wireless['short_wpa'], data_basic['wlan_pc']) tmp2.dhcp_release_wlan(data_basic['wlan_pc']) result4 = tmp2.get_bannedclients_title() # self.assertNotIn(data_wireless['all_ssid'], result1) # self.assertIn(wlan_mac, result2) self.assertIn(data_wireless['all_ssid'], result3) self.assertNotIn(wlan_mac, result4), "check reconnection timeout function is hourly, test fail!" print "check reconnection timeout function is hourly, test pass!"