예제 #1
0
    def write_user(self, num):
        '''

        :param num: 写入第几个工作簿
        :return:
        '''
        # print(len(data_user))
        # print(data_user[0])
        self.data_user = ExcelData('user').readData()
        self.write0 = WriteData(num)
        i = 2
        j = 3
        l = 4
        k = 1
        for data in self.data_user:
            data = data.get('body')
            # print(data)
            data = ast.literal_eval(data)
            resp = json.loads(self.http.post(self.url, data=data))
            # print(resp )
            if self.http.get_value(resp, 'err_msg') == 'success':
                self.write0.write(k, j, self.http.get_value(resp, 'userid'))
                # print(k,j,self.http.get_value(resp, 'userid'))
                self.write0.write(k, i, self.http.get_value(resp, 'token'))
                # print(k,i,self.http.get_value(resp, 'token'))

            self.write0.write(k, l, self.http.get_value(resp, 'err_msg'))
            k += 1

        bookname = random.randint(0, 100)
        self.write0.save('{}.xls'.format(bookname))
예제 #2
0
@Project: PyCharm
@Author: wangmin
@Data: 2019/1/23
"""
import json
import unittest
import ddt

from lib.web.business import BusinessApi
from lib.web.client import HttpHandler
from config.RandomChinese import Random_Chinese
from config.ReadExcel import ExcelData
from config.cnf import Config
from config.mysql import MysqlData

data = ExcelData('cwebapi').readData()


# print(data)
@ddt.ddt
class HqsApi(unittest.TestCase):
    @classmethod
    def setUpClass(cls):
        cls.http = HttpHandler()
        cls.lib = BusinessApi()
        cls.mysql = MysqlData()
        cls.config = Config()
        cls.randomc = Random_Chinese()
        cls.user = cls.lib.get_token()

    @ddt.data(*data[0:1])
예제 #3
0
@Author: wangmin
@Data: 2019/1/18
"""

import json
import unittest

import ddt

from lib.web.business import BusinessApi
from lib.web.client import HttpHandler
from config.ReadExcel import ExcelData
from config.cnf import Config
from config.mysql import MysqlData

data= ExcelData('create').readData()

@ddt.ddt
class HqsApi(unittest.TestCase):
    @classmethod
    def setUpClass(cls):
        cls.http = HttpHandler()
        cls.lib = BusinessApi()
        cls.mysql = MysqlData()
        cls.config = Config()

    @ddt.data(*data[1:2])
    def test1_create_review_is_ok(self, data):
        ''' 视频帖发布评论 '''

        post_data = data['Request_Data']
예제 #4
0
@Project: PyCharm
@Author: wangmin
@Data: 2019/1/22
"""
import json
import unittest

import ddt

from lib.web.business import BusinessApi
from lib.web.client import HttpHandler
from config.ReadExcel import ExcelData
from config.cnf import Config
from config.mysql import MysqlData

data = ExcelData('cappapi').readData()


@ddt.ddt
class HqsApi(unittest.TestCase):
    @classmethod
    def setUxxlass(cls):
        cls.http = HttpHandler()
        cls.lib = BusinessApi()
        cls.mysql = MysqlData()
        cls.config = Config()
        cls.user = cls.lib.get_token()

    # @ddt.data(*data[6:7])
    # def test1_create_dynamic_video_is_ok(self, data):
    #     ''' 发布视频帖 '''
예제 #5
0
@Version: 
@Project: PyCharm
@Author: wangmin
@Data: 2018/9/21
"""
import unittest

import ddt

# from app.web.business import BusinessApi
# from app.web.client import HttpHandler
from config.ReadExcel import ExcelData
from config.cnf import Config
from config.mysql import MysqlData

data = ExcelData('webstatus').readData()


@ddt.ddt
class HqsApi(unittest.TestCase):
    @classmethod
    def setUpClass(cls):
        cls.http = HttpHandler()
        cls.lib = BusinessApi()
        cls.mysql = MysqlData()
        cls.config = Config()

    @ddt.data(*data[1:37])
    def test1_status(self, data):
        """ 接口状态测试 """
        resp = self.http.post_code(self.lib.appapi_url + data['Request_URL'],