Ejemplo n.º 1
0
 def get_session(cls,base_path):
     content=uiti.get_json(base_path)
     URL='%s://%s:%s/%s'%(content['PROTOCOL'],content['HOST'],content['PORT'],content['AURL'])
     data = {'userName':content['username'],'userPass':content['password'],'checkcode':content['checkcode']}
     session = requests.session()
     resp=session.post(URL,data)
     return session
 def get_session(cls, base_path):
     content = uiti.get_json(base_path)
     #URL='%s://%s:%s/%s'%(content['PROTOCOL'],content['HOST'],content['PORT'],content['AURL'])
     URL = 'http://192.168.254.131:8080/WoniuBoss2.5/log/userLogin'
     data = {
         'userName': content['username'],
         'userPass': content['password'],
         'checkcode': content['checkcode']
     }
     session = requests.session()
     session.post(URL, data)
     return session
Ejemplo n.º 3
0
    def miss_login(cls, driver, base_path):

        cls.open_page(driver, base_path)
        # 通过字典方式传递cookie信息

        contents = uiti.get_json(base_path)
        driver.add_cookie({'name': 'userName', 'value': contents['username']})
        driver.add_cookie({'name': 'userPass', 'value': contents['password']})
        driver.add_cookie({
            'name': 'checkcode',
            'value': contents['checkcode']
        })
        cls.open_page(driver, base_path)
# -*- coding: utf-8 -*-
import unittest

from parameterized import parameterized

from common.login import Login
from tools.service import Service
from tools.uiti import uiti

test_info = uiti.get_json('..\\conf\\testdata.conf')
login_infos = uiti.trans_dict_tup(test_info[0])


class loginTest(unittest.TestCase):
    def setUp(self):
        pass

    def tearDown(self):
        pass

    #登录
    @parameterized.expand(login_infos)
    def test_login(self, URL, METHOD, DATA, CODE, CONTENT, expect):
        login_info = {
            'userName': DATA['userName'],
            'userPass': DATA['userPass'],
            'checkcode': DATA['checkcode']
        }
        resp = Login().do_login(URL, login_info)
        flag = uiti.assert_equal(str(resp.text), CONTENT)
        if flag:
Ejemplo n.º 5
0
 def open_page(cls, base_path, driver):
     content = uiti.get_json(base_path)
     URL = '%s://%s:%s/%s' % (content['PROTOCOL'], content['HOST'],
                              content['PORT'], content['AURL'])
     driver.get(URL)
Ejemplo n.º 6
0
 def get_driver(cls, base_path):
     content = uiti.get_json(base_path)
     driver = getattr(webdriver, content['BROWSER'])()
     driver.implicitly_wait(10)
     driver.maximize_window()
     return driver