Esempio n. 1
0
 def test_048_check_connection_time_d_function(self):
     u"""Connection Time单位选择d天,功能测试(testlink_ID:3204)"""
     log.debug("048")
     tmp2 = BannedClientsBusiness(self.driver)
     #断开无线网卡的连接
     tmp2.disconnect_ap()
     #先解锁客户端
     tmp2.unblock_clients(1)
     #先修改ap的系统时间为2018-08-08 01:00:00
     ssh = SSH(data_basic['DUT_ip'], data_login['all'])
     ssh.ssh_cmd(data_basic['sshUser'], "date 201808080100")
     #按照默认配置,编辑一个时间策略-1天
     tmp = TimePolicyBusiness(self.driver)
     tmp.edit_timepolicy_default(0, u"时间策略1", "1", "23", "d")
     #无线网卡连接
     tmp.connect_DHCP_WPA_AP(data_wireless['all_ssid'],
         data_wireless['short_wpa'], data_basic['wlan_pc'])
     #再修改ap的系统时间为2018-08-09 01:00:00
     ssh = SSH(data_basic['DUT_ip'], data_login['all'])
     ssh.ssh_cmd(data_basic['sshUser'], "date 201808090100")
     #等待3分钟
     time.sleep(180)
     #判断AP是否依然连接
     result1 = subprocess.check_output("iw dev %s link"%data_basic['wlan_pc'], shell=True)
     #释放无线网卡的ip
     tmp.dhcp_release_wlan(data_basic['wlan_pc'])
     #获取禁止的客户端页面所有标题
     result2 = tmp2.get_bannedclients_title()
     wlan_mac = tmp2.get_wlan_mac(data_basic['wlan_pc']).upper()
     self.assertNotIn(data_wireless['all_ssid'], result1)
     self.assertIn(wlan_mac, result2),
     "check connection time function is day, test fail!"
     print "check connection time function is day, test pass!"
Esempio n. 2
0
    def test_051_check_timeout_reconnection_weekly_function(self):
        u"""Timeout type选择reset weekly测试(testlink_ID:3207)"""
        log.debug("051")
        tmp2 = BannedClientsBusiness(self.driver)
        #等待4分钟--等待客户端再次被踢掉
        time.sleep(240)
        #先解锁客户端
        tmp2.unblock_clients(1)
        #断开无线网卡的连接
        tmp2.disconnect_ap()
        tmp = TimePolicyBusiness(self.driver)
        tmp.change_timeout_weekly(0, u"星期三", "23")
        #先修改ap的系统时间为2018-08-07 22:00:00(当天是星期二)
        ssh = SSH(data_basic['DUT_ip'], data_login['all'])
        ssh.ssh_cmd(data_basic['sshUser'], "date 201808072200")
        #无线网卡连接
        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)
        #获取禁止的客户端页面所有标题
        tmp2.dhcp_release_wlan(data_basic['wlan_pc'])
        result2 = tmp2.get_bannedclients_title()
        wlan_mac = tmp2.get_wlan_mac(data_basic['wlan_pc']).upper()

        #再修改ap的系统时间为2018-08-08 22:59:00(当天是星期三)
        ssh = SSH(data_basic['DUT_ip'], data_login['all'])
        ssh.ssh_cmd(data_basic['sshUser'], "date 201808082259")
        #等待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()

        #测试完毕,禁用无线网卡,使pc够上网
        tmp.dhcp_release_wlan(data_basic['wlan_pc'])
        tmp.disconnect_ap()
        tmp.wlan_disable(data_basic['wlan_pc'])
        #rsyslog服务器完成工作
        tmp.finish_rsyslog("ClientTimePolicy")
        # 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 weekly, test fail!"
        print "check reconnection timeout function is weekly, test pass!"