Esempio n. 1
0
 def test_046_check_connection_m_time_function(self):
     u"""Connection Time单位选择m分钟,功能测试(testlink_ID:3202)"""
     log.debug("046")
     tmp = TimePolicyBusiness(self.driver)
     #断开无线网卡的连接
     tmp.disconnect_ap()
     #先修改ap的系统时间为01:00:00
     ssh = SSH(data_basic['DUT_ip'], data_login['all'])
     ssh.ssh_cmd(data_basic['sshUser'], "date -s 01:00:00")
     #按照默认配置,新建一个时间策略
     tmp.new_timepolicy_default(0, u"时间策略1", "2", "23", "m")
     #进入网络组中选择客户端时间策略
     tmp1 = SSIDBusiness(self.driver)
     tmp1.change_client_time_policy_pagedown(1, u"时间策略1")
     #无线网卡连接
     tmp1.connect_DHCP_WPA_AP(data_wireless['all_ssid'],
         data_wireless['short_wpa'], data_basic['wlan_pc'])
     #等待3分钟
     time.sleep(240)
     #判断AP是否依然连接
     result1 = subprocess.check_output("iw dev %s link"%data_basic['wlan_pc'], shell=True)
     #释放无线网卡的ip
     tmp1.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()
     self.assertNotIn(data_wireless['all_ssid'], result1)
     self.assertIn(wlan_mac, result2),
     "check connection time function is min, test fail!"
     print "check connection time function is min, 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!"