def tearDownClass(cls) -> None: '''删除测试产品''' sql_product = "SELECT id FROM product WHERE flag=0 AND (`code`<1 OR `code`>699)" sql_product_data = OperationMysql().search_all(sql_product) if sql_product_data != None: sql_count = sql_product_data[0] for i in range(sql_count): pid = sql_product_data[1][i]['id'] data = json.dumps({"productId": pid}) url = globalvar.Base_Url + '/product/del' requests.post(url=url, data=data, headers=cls.header) else: pass '''删除测试厂商''' sql_firm = "SELECT id FROM firm WHERE flag=0 AND (`code`<1 OR `code`>699)" sql_firm_data = OperationMysql().search_all(sql_firm) if sql_firm_data != None: sql_count = sql_firm_data[0] for i in range(sql_count): fid = sql_firm_data[1][i]['id'] data = json.dumps({"firmId": fid}) url = globalvar.Base_Url + '/firm/del' requests.post(url=url, data=data, headers=cls.header) else: pass
def tearDownClass(cls) -> None: '''删除测试房间''' sql_room = "SELECT id FROM room WHERE creator=1693143315735314432 AND name!='默认房间' AND flag=0" sql_room_data = OperationMysql().search_all(sql_room) if sql_room_data != None: sql_count = sql_room_data[0] for i in range(sql_count): rid = sql_room_data[1][i]['id'] data = json.dumps({"roomId": rid}) url = globalvar.Base_Url + '/room/del' response = requests.post(url=url, data=data, headers=cls.header) else: pass '''删除测试家庭''' sql_scene = "SELECT id FROM scene WHERE owner_id=1693143315735314432 AND name!='默认家庭' AND flag=0" sql_scene_data = OperationMysql().search_all(sql_scene) if sql_scene_data != None: sql_count = sql_scene_data[0] for i in range(sql_count): sid = sql_scene_data[1][i]['id'] data = json.dumps({"sceneId": sid}) url = globalvar.Base_Url + '/scene/del' response = requests.post(url=url, data=data, headers=cls.header) else: pass
def tearDownClass(cls) -> None: '''删除测试厂商''' sql_room = "SELECT id FROM firm WHERE flag=0 AND (`code`<1 OR `code`>699)" sql_room_data = OperationMysql().search_all(sql_room) if sql_room_data != None: sql_count = sql_room_data[0] for i in range(sql_count): rid = sql_room_data[1][i]['id'] data = json.dumps({"roomId": rid}) url = globalvar.Base_Url + '/room/del' response = requests.post(url=url, data=data, headers=cls.header) else: pass
def tearDownClass(cls) -> None: sql = "SELECT id FROM scene WHERE owner_id=1693143315735314432 AND name!='默认家庭' AND flag=0" sql_data = OperationMysql().search_all(sql) if sql_data != None: sql_count = sql_data[0] for i in range(sql_count): sid = sql_data[1][i]['id'] data = json.dumps({"sceneId": sid}) url = globalvar.Base_Url + '/scene/del' header = OperationHeader().get_header() response = requests.post(url=url, data=data, headers=header) else: pass
def get_expcet_data_for_mysql(self,row): op_mysql = OperationMysql() sql = self.get_expcet_data(row) res = op_mysql.search_one(sql) return res.decode('unicode-escape')