Beispiel #1
0
 def setUp(self):
     """
     :return:
     """
     self.log = MyLog.get_log()
     self.logger = self.log.get_logger()
     '''登陆获取token'''
     # set url
     self.url = commonAw.get_url_from_xml('companylist')
     localConfigHttp.set_url(self.url)
     # set header
     localConfigHttp.set_headers(self.headers)
    def setUp(self):
        """
        :return:
        """
        self.log = MyLog.get_log()
        self.logger = self.log.get_logger()
        # set url
        self.url = commonAw.get_url_from_xml('busUserlogin')
        localConfigHttp.set_url(self.url)

        # set header
        localConfigHttp.set_headers(self.headers)
Beispiel #3
0
    def testUserLogin(self):
        """
        test body
        :return:
        """
        # set url
        self.url = commonAw.get_url_from_xml('userlogin')
        localConfigHttp.set_url(self.url)

        # set headers
        localConfigHttp.set_data(self.body)
        localConfigHttp.set_headers(self.headers)
        # post http
        self.response = localConfigHttp.post()
        # check result
        self.checkResult()
def logout(token):
    """
    logout
    :param token: login token
    :return:
    """
    # set url
    url = commonAw.get_url_from_xml('logout')
    localConfigHttp.set_url(url)

    # set header
    header = {'token': token}
    localConfigHttp.set_headers(header)

    # logout
    localConfigHttp.get()
Beispiel #5
0
    def setUp(self):
        """
        :return:
        """
        self.log = MyLog.get_log()
        self.logger = self.log.get_logger()

        # set url
        self.url = commonAw.get_url_from_xml('userlogin')
        localConfigHttp.set_url(self.url)

        # set headers&body
        localConfigHttp.set_data(self.body)
        localConfigHttp.set_headers(self.headers)
        # post http
        self.response = localConfigHttp.post()
        self.info = self.response.json()
        self.token = self.info['data']['token']
def login():
    """
    login
    :return: token
    """
    # set url
    url = commonAw.get_url_from_xml('login')
    localConfigHttp.set_url(url)

    # set header
    token = localReadConfig.get_headers("token_v")
    header = {"token": token}
    localConfigHttp.set_headers(header)

    # set param
    data = {"email": localLogin_xls[0][3], "password": localLogin_xls[0][4]}
    localConfigHttp.set_data(data)

    # login
    response = localConfigHttp.post().json()
    token = commonAw.get_value_from_return_json(response, "member", "token")
    return token
Beispiel #7
0
    def testLogin(self):
        """
        test body
        :return:
        """
        # set url
        self.url = commonAw.get_url_from_xml('login')
        configHttp.set_url(self.url)
        print("第一步:设置url  " + self.url)

        # get visitor token
        if self.token == '0':
            token = localReadConfig.get_headers("token_v")
        elif self.token == '1':
            token = None

        # set headers
        header = {"token": str(token)}
        configHttp.set_headers(header)
        print("第二步:设置header(token等)")

        # set params
        data = {"email": self.email, "password": self.password}
        configHttp.set_data(data)
        print("第三步:设置发送请求的参数")

        # test interface
        self.return_json = configHttp.post()
        method = str(self.return_json.request
                     )[int(str(self.return_json.request).find('[')) +
                       1:int(str(self.return_json.request).find(']'))]
        print("第四步:发送请求\n\t\t请求方法:" + method)

        # check result
        self.checkResult()
        print("第五步:检查结果")
Beispiel #8
0
    def testUserInfo(self):
        """
        test body
        :return:
        """
        # set url
        self.url = commonAw.get_url_from_xml('userinfo')
        localConfigHttp.set_url(self.url)

        # set headers
        headers = {
            'clientVersion': '4.0.0',
            'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
        }

        token = '8f5212edcb034d4aae41b6efa23b919d'
        body = 'channel_id=0&sid=8993a8dcf7424b9d89b292b62f881fb0&game_id=1024&token=' + token + '&'
        print(body)
        localConfigHttp.set_data(body)
        localConfigHttp.set_headers(headers)
        # post http
        self.response = localConfigHttp.post()
        # check result
        self.checkResult()