Example #1
0
 def test_advpwd(self):
     login_control.set_user(self,adv_usr,adv_pwd)
     login_control.submit(self)
     admin_control.menu(self)
     result = admin_business.updatePassword(self,letter_pwd,letter_pwd)
     assert result == True,u'密码修改成功后,使用修改后的密码登陆不进去'
     print u'高级用户非默认密码登录--验证成功'
Example #2
0
 def setUp(self):
    self.driver = webdriver.Firefox()
    self.driver.implicitly_wait(10)
    self.driver.get(url)
    login_control.set_user(self,user,pwd)
    login_control.submit(self)
    system_control.menu(self)
Example #3
0
     def setUp(self):
        self.driver = webdriver.Firefox()

        self.driver.get(url)
        login_control.set_user(self,user,pwd)
        login_control.submit(self)
        self.driver.implicitly_wait(10)
        #public_control.menu(self,u'网络',u'Qos-ip')
        qosIP_control.menu(self)
Example #4
0
 def tearDown(self):
    self.driver.get(url)
    login_control.set_user(self,user,pwd)
    login_control.submit(self)
    self.driver.implicitly_wait(10)
    qosIP_control.menu(self)
    qosIP_control.set_qos_ip_enable(self)
    qosIP_control.delete_multi(self)
    self.driver.quit()
Example #5
0
def updatePassword(self,pwd1,pwd2):
         driver = self.driver
         admin_control.set_pwd(self,pwd1,pwd2)
         admin_control.submit(self)
         login_control.logout(self)
         login_control.set_user(self,'root',pwd1)
         login_control.submit(self)
         title = driver.title
         return u'总览' in title
Example #6
0
 def test_managePurview_0039(self):
     u'''修改密码为空--100msh0039 '''
     admin_control.set_pwd(self,'','')
     admin_control.submit(self)
     login_control.logout(self)
     login_control.set_user(self,'root','bm100@rut!%v2')
     login_control.submit(self)
     title = self.driver.title
     assert u'总览' in title,u'页面上修改密码为空后,使用原来的密码登陆不进去'
     print u'修改密码为空--验证成功'
Example #7
0
 def test_restore_ssh(self):
     general_control.wifidog_menu(self)
     gatewayId1 = general_control.get_gatewayId(self)
     general_control.set_gatewayId(self,'11111111111')
     ssh.ssh_cmd(ip,user,pwd,'reset')
     self.driver.implicitly_wait(50)
     self.driver.get(url)
     login_control.set_user(self,user,pwd)
     login_control.submit(self)
     general_control.wifidog_menu(self)
     gatewayId2 = general_control.get_gatewayId(self)
     assert gatewayId1==gatewayId2,u'后台恢复出场设置后网关ID恢复默认值'
Example #8
0
def goin_interface(self):
    try:
        #获取默认web页面登录的ip,用户名和密码
        web_user_password = data.default_web_user_password()
        #登录路由
        login_control.set_user(self,web_user_password[1],web_user_password[2])
        login_control.submit(self)
        #进入接口页面
        interface_control.interface_menu(self)
        time.sleep(5)
    #捕捉异常并打印异常信息
    except Exception,e:
        print u"登录路由并进入接口页面失败,原因如下:\n%s"%e
Example #9
0
 def test_reboot(self):
     self.driver.get(url)
     login_control.set_user(self,user,pwd)
     login_control.submit(self)
     reboot_control.menu(self)
     reboot_control.reboot(self)
     time.sleep(5)
     p = os.system(string)
     assert p !=0 ,u'未进行重启动作'
     print u'正在重启中'
     time.sleep(60)
     p = os.system(string)
     assert p ==0 ,u'页面重启失败'
     print u'页面重启成功'
Example #10
0
def goin_default_dhcpdns(self):
    try:
        driver = self.driver
        #默认IP登录路由web页面
        web_user_password = data.default_web_user_password()
        interface_business.open_router_web(self,web_user_password[0])
        #登录路由
        login_control.set_user(self,web_user_password[1],web_user_password[2])
        login_control.submit(self)
        #进入DHCP/DNS页面
        dhcpdns_control.dhcpdns_menu(self)
        driver.implicitly_wait(10)
     #捕捉异常并打印异常信息
    except Exception,e:
        print u"使用默认ip登录DHCP/DNS页面失败,原因如下:\n%s"%e
Example #11
0
 def test_rebootLoop(self):
     for i in range(1,6):
         for j in range(0,20):
             self.driver.get(url)
             login_control.set_user(self,user,pwd)
             login_control.submit(self)
             reboot_control.menu(self)
             reboot_control.reboot(self)
             self.driver.implicitly_wait(50)
         login_control.set_user(self,user,pwd)
         login_control.submit(self)
         public_control.menu(self,u'网络',u'门户认证')
         result1 = network_control.network(self,"http://www.sina.com.cn",u"新浪")
         assert result1==True, u'第%d次反复重启20次后门户认证失败,程序中断' %i
         print u'第%d次反复重启20次后门户认证生效' %i
         result2 =privoxy_control.get_js(self)
         assert 'http://chdadd.100msh.com/ad.js' in result2,u'第%d次反复重启20次后如影随行功能不生效' %i
Example #12
0
 def test_testore_func(self):
     general_control.wifidog_menu(self)
     gatewayId1 = general_control.get_gatewayId(self)
     general_control.set_gatewayId(self,'11111111111')
     general_control.apply(self)
     restore_control.menu(self)
     restore_control.set_restore(self)
     alert = restore_control.get_alert(self)
     alert.accept()
     #time.sleep(60)
     self.driver.implicitly_wait(50)
     self.driver.get(url)
     login_control.set_user(self,user,pwd)
     login_control.submit(self)
     general_control.wifidog_menu(self)
     gatewayId2 = general_control.get_gatewayId(self)
     assert gatewayId1==gatewayId2,u'恢复出场设置后网关ID恢复默认值'
    def test(self):
        print '1'
        ip = '192.168.11.1'
        user = '******'
        password = '******'
        #上传tcpdump到路由器
        tcpdump_control.scp_to_remote(
            '/home/zeng/PycharmProjects/BHU/data/BHU_tcpdump/tcpdump', ip,
            user, password, '/usr/sbin/')
        print '2'
        tcpdump_control.scp_to_remote(
            '/home/zeng/PycharmProjects/BHU/data/BHU_tcpdump/libpcap.so.1.3',
            ip, user, password, '/usr/lib/')

        print '3'
        #默认IP登录路由web页面
        web_user_password = data.default_web_user_password()
        interface_business.open_router_web(self, web_user_password[0])
        #登录路由
        login_control.set_user(self, web_user_password[1],
                               web_user_password[2])
        login_control.submit(self)
        time.sleep(3)
        #进入门户认证,修改网关ID
        general_control.wifidog_menu(self)
        print '4'
        #修改门户认证的检查间隔为60s
        general_control.set_checkInterval(self, '60')
        general_control.apply(self)
        time.sleep(60)
        print '5'
        #ssh登录路由输入tcpdump抓包
        tcpdump_control.tcpdump_command(user, ip, password,
                                        'tcpdump -i eth1 -s0 -w /tmp/wanlog')
        tcpdump_control.scp_to_local(ip, user, password, '/tmp/wanlog',
                                     '/home/zeng/')

        f = open('/home/zeng/wanlog')
        log = f.read()
        f.close()

        if 'GET /index/ping/?gw_id=' in log:
            print 'pass'
        else:
            print 'failed'
Example #14
0
 def test(self):
     i = 0
     while True:
         ping = public.get_ping('192.168.11.1')
         #如果能够ping通路由,则表示未失败
         if ping == 0:
             #打开reboot.txt文件,写入pass
             f = open('reboot.txt', 'a')
             f.writelines('第%d次测试pass\n' % i)
             f.close()
             D = data.default_web_user_password()
             try:
                 #打开路由页面,确认路由页面是否能显示
                 self.driver.get('http://%s:8088' % D[0])
                 time.sleep(5)
                 self.driver.find_element_by_name('username')
             except:
                 #不能显示路由页面,则登录ssh重启路由
                 wifidog_business.reboot(self)
             finally:
                 #登录路由页面
                 self.driver.get('http://%s:8088' % D[0])
                 login_control.set_user(self, D[1], D[2])
                 login_control.submit(self)
                 time.sleep(3)
                 #进入门户认证,修改网关ID
                 general_control.wifidog_menu(self)
                 general_control.set_rand_gatewayId(self)
                 general_control.apply(self)
                 time.sleep(60)
                 #再次重启路由
                 wifidog_business.reboot(self)
         #不能ping通则打开reboot.txt文件写入fail,退出循环
         else:
             f = open('reboot.txt', 'a')
             f.writelines('第%d次测试fail\n' % i)
             f.closed()
             break
         i += 1
    def test(self):
        print '1'
        ip ='192.168.11.1'
        user = '******'
        password = '******'
        #上传tcpdump到路由器
        tcpdump_control.scp_to_remote('/home/zeng/PycharmProjects/BHU/data/BHU_tcpdump/tcpdump',ip,user,password,'/usr/sbin/')
        print '2'
        tcpdump_control.scp_to_remote('/home/zeng/PycharmProjects/BHU/data/BHU_tcpdump/libpcap.so.1.3',ip,user,password,'/usr/lib/')

        print '3'
        #默认IP登录路由web页面
        web_user_password = data.default_web_user_password()
        interface_business.open_router_web(self,web_user_password[0])
        #登录路由
        login_control.set_user(self,web_user_password[1],web_user_password[2])
        login_control.submit(self)
        time.sleep(3)
        #进入门户认证,修改网关ID
        general_control.wifidog_menu(self)
        print '4'
        #修改门户认证的检查间隔为60s
        general_control.set_checkInterval(self,'60')
        general_control.apply(self)
        time.sleep(60)
        print '5'
        #ssh登录路由输入tcpdump抓包
        tcpdump_control.tcpdump_command(user,ip,password,'tcpdump -i eth1 -s0 -w /tmp/wanlog')
        tcpdump_control.scp_to_local(ip,user,password,'/tmp/wanlog','/home/zeng/')

        f = open('/home/zeng/wanlog')
        log = f.read()
        f.close()

        if 'GET /index/ping/?gw_id=' in log:
            print 'pass'
        else:
         print 'failed'
Example #16
0
 def test_21bytepwd(self):
     login_control.set_user(self,web_usr,max_pwd1)
     login_control.submit(self)
     login_control.get_error(self)
     print u'登陆密码长度大于最大有效值时--验证成功'
     login_business.default_login(self)
Example #17
0
 def test_5bytepwd(self):
     login_control.set_user(self,general_usr,mini_pwd1)
     login_control.submit(self)
     login_control.get_error(self)
     print u'登陆密码长度小于最小有效值时--验证成功'
     login_business.default_login(self)
Example #18
0
 def test_1bytepwd(self):
     login_control.set_user(self,general_usr,'1')
     login_control.submit(self)
     login_control.get_error(self)
     print u'登陆密码为1字节时--验证成功'
     login_business.default_login(self)
Example #19
0
 def test_unllusr(self):
     login_control.set_user(self,'',general_pwd)
     login_control.submit(self)
     login_control.get_error(self)
     print u'登陆用户名为空--验证成功'
     login_business.default_login(self)
Example #20
0
 def test_nulllogin(self):
     login_control.set_user(self,'','')
     login_control.submit(self)
     login_control.get_error(self)
     print u'登陆用户名、密码都为空时--验证成功'
     login_business.default_login(self)
Example #21
0
 def test_advdefault(self):
     login_control.set_user(self,adv_usr,adv_pwd)
     login_control.submit(self)
     login_control.get_error(self)
     print u'高级用户默认密码登录--验证成功'