Ejemplo n.º 1
0
 def test_api_vpn_login4(self):
     '''登录测试,正确的用户名,密码为空'''
     # try:
     username = "******"
     password = ""
     result = api_vpn_login().testapi_vpn_login(username, password)
     self.assertEqual(result['msg'], '用户不存在或口令错误,请正确输入并重试')
Ejemplo n.º 2
0
 def test_api_vpn_login3(self):
     '''测试登录,用户名密码为空'''
     # try:
     username = ""
     password = ""
     result = api_vpn_login().testapi_vpn_login(username, password)
     self.assertEqual(result['msg'], '用户不存在或口令错误,请正确输入并重试')
 def test_add_dns_agent(self):
     '''正确的IP地址'''
     username = '******'
     password = '******'
     result = api_vpn_login().testapi_vpn_login(username, password)
     data_session = result['session_id']
     api_add_cookies().api_add_cookies(data_session)
     dns_address = "1.1.1.6"
     result2 = api_vpn_add_dns_agent().add_dns_agent(dns_address)
     print(result2)
     self.assertEqual(result2['msg'], '0', '添加失败')
Ejemplo n.º 4
0
 def test_vpn_add_api(self):
     '''正确的IP地址和子网掩码'''
     username='******'
     password='******'
     result=api_vpn_login().testapi_vpn_login(username,password)
     data_session=result['session_id']
     api_add_cookies().api_add_cookies(data_session)
     add_ip="1.1.1.4"
     add_msat="255.255.224.0"
     result2=test_api_add().api_add1(add_ip,add_msat)
     print(type(result2))
     print("获取的登录界面内容是%s"%(result2))   
     self.assertEqual()
 def test_add_chlidrenapi(self):
     '''正确的配置子接口'''
     username = '******'
     password = '******'
     result = api_vpn_login().testapi_vpn_login(username, password)
     data_session = result['session_id']
     api_add_cookies().api_add_cookies(data_session)
     chliren_ip = "1.1.1.3"
     chlidren_mask = "255.0.0.0"
     result2 = api_add_chlidrenApi().add_chlidren_api(
         chliren_ip, chlidren_mask)
     print(result2)
     result3 = BeautifulSoup(result2, "html.parser")
     chlidrenapi_string = result3.rows.msg.string
     self.assertEqual(chlidrenapi_string, '0')
 def test_delete_childrenapi(self):
     '''删除单个子接口'''
     username = '******'
     password = '******'
     result = api_vpn_login().testapi_vpn_login(username, password)
     #用户名密码登录
     data_session = result['session_id']
     api_add_cookies().api_add_cookies(data_session)
     #关联sessionID
     #子接口界面刷新
     result2 = getallsubbyname().getallsub()
     #删除子接口
     data2 = BeautifulSoup(result2, "html.parser")
     number = 0
     data1 = []  #将row列表添加到序列
     aa = []  #row string添加到列表
     a1 = []  #修改子接口格式byte eth.x 到序列
     aa_children = '.'
     for i in data2.rows.contents:
         data1.append(i)
         if number == 0:
             pass
         else:
             aa.append(data1[number].cell.string)
         number = number + 1
         for i1 in aa:  #修改字节流的格式
             a1_eth = i1.split(':')[0]
             a1_eth2 = i1.split(':')[1]
             a1_eth3 = a1_eth + aa_children + a1_eth2
             a1.append(a1_eth3)
         print('添加a1%s' % a1)
     if aa != []:
         eth = a1[0]
         r1 = delete_chlidrenapi().vpn_delete_chlidrenapi(eth)
         print(r1)
     else:
         print("子接口为空")
Ejemplo n.º 7
0
 def test_api_vpn_login5(self):
     '''登录测试,正确的账号,密码为数字、字母、字符、特殊字符、空格'''
     username = "******"
     password = "******"
     result = api_vpn_login().testapi_vpn_login(username, password)
     self.assertEqual(result['msg'], '用户不存在或口令错误,请正确输入并重试')
Ejemplo n.º 8
0
 def test_api_vpn_login2(self):
     '''测试登录,正确的账号,错误的密码'''
     username = '******'
     password = '******'
     result = api_vpn_login().testapi_vpn_login(username, password)
     self.assertEqual(result['msg'], "用户不存在或口令错误,请正确输入并重")
Ejemplo n.º 9
0
 def test_api_vpn_login1(self):
     '''测试登录,正确的账号,正确的密码'''
     username = '******'
     password = '******'
     result = api_vpn_login().testapi_vpn_login(username, password)
     self.assertEqual(result['msg'], '0', "登录失败")