Example #1
0
    def send_xml(self, path):
        start = datetime.datetime.now()
        url = "http://10.1.1.71:9999/auditcenter/api/v1/auditcenter"
        headers = {"Content-Type": "text/plain"}
        files = os.listdir(path)
        n = 0
        for file in files:

            with open(os.path.join(path, file),
                      mode='r',
                      encoding='utf-8',
                      buffering=True) as f:
                file_content = f.read()
                res = requests.post(url,
                                    data=file_content.encode("utf-8"),
                                    headers=headers)
                log.info("执行结果:{}".format(res.json()))

            n += 1
            if n % 100 == 0:
                time.sleep(10)
        end = datetime.datetime.now()
        print(end - start)
Example #2
0
 def __init__(self):
     path = os.path.dirname(os.path.abspath(__file__))
     configfile = os.path.join(path, 'config.ini')
     self.conf = ConfigParser()
     log.info('开始解析配置文件...')
     self.conf.read(configfile, encoding='utf8')
Example #3
0
 def req(self, content):
     headers = {"Content-Type": "text/plain"}
     res = self.client.post("/api/v1/auditcenter",
                            data=content.encode("utf-8"),
                            headers=headers)
     log.info("执行结果:{}".format(res.json()))
Example #4
0
 def get(self,field,key):
     data = self.conf.get(field,key)
     if data.isdigit():
         data = int(data)
     log.info("读取配置文件{}-{}的值为{}".format(field,key,data))
     return data
Example #5
0
 def tearDownClass(cls):
     log.info('------{}测试用例执行结束------'.format(cls.__doc__))
Example #6
0
 def setUpClass(cls):
     log.info('------开始执行{}测试用例------'.format(cls.__doc__))
Example #7
0
 def req(self, content):
     url = "http://10.1.1.71:9999/auditcenter/api/v1/auditcenter"
     headers = {"Content-Type": "text/plain"}
     res = requests.post(url, data=content.encode("utf-8"), headers=headers)
     log.info("执行结果:{}".format(res.json()))
Example #8
0
 def setUpClass(cls):
     log.info('------开始执行{}测试用例------'.format(cls.__doc__))
     cls.g = globals()
     cls.base_url = config.get('auditcenter', 'url') + '/api/v1/auditPlan'
     cls.plan_list = config.get('auditcenter', 'url') + '/api/v1/auditPlanList'
     cls.plan_name = "测试审方方案"