def water_closed_test(self): """ 闭水试验 :return: """ base.consoleLog('闭水试验') url = "http://decorate.ishangzu.com/isz_decoration/NewDecorationProjectController/survey/closed" idCardPhotos = interface.upLoadPhoto(self.url, base.get_conf('Img', 'picture_name'), base.get_conf('Img', 'file_path'),value='rsm') data = { "remark": "闭水试验备注", "attachments": [{ "attach_type": "SCENE", "imgs": [{ "url": idCardPhotos["src"], "img_id": idCardPhotos["img_id"], "create_name": "", "create_dept": "", "create_time": "", "sort": 0, "type": "" }] }], "project_id": self.project_id, "closed_water_test_result": "Y", "is_need_waterproofing": "N"} result = interface.myRequest(url, data) if result['code'] != 0: base.consoleLog('闭水试验接口执行失败!') return result['msg'] base.consoleLog('闭水试验接口执行成功!') return
def getsmsMtHis(destPhone): # conn = MongoClient('mongodb://*****:*****@192.168.0.200:27020/') conn = MongoClient('mongodb://{}:{}@{}:{}/'.format( get_conf('mongodb', 'user'), get_conf('mongodb', 'pwd'), get_conf('mongodb', 'address'), get_conf('mongodb', 'port'))) row = conn.sms.smsMtHis.find({ 'destPhone': destPhone }).sort([{"create_time", -1}]) return re.findall('验证码:(.*?),', row[0]['content'].encode('utf-8'))[0]
def auditHouse(): """审核房源""" try: base = Base() #需要从配置文件读取新增的房源信息才能做审核操作 residential = get_conf('residential', 'residentialname') building = get_conf('residential', 'buildingname') unit = get_conf('residential', 'unitname') houseno = get_conf('residential', 'housenoname') address = residential + building + unit + houseno base.open(page.houseAuditPage, houseAuditPage.houseAuditPageloc['audit_btn']) base.input_text(houseAuditPage.searchMould['residentia_name_loc'], residential) base.input_text(houseAuditPage.searchMould['building_name_loc'], building) base.input_text(houseAuditPage.searchMould['unit_name_loc'], unit) base.input_text(houseAuditPage.searchMould['houseno_name_loc'], houseno) base.click(houseAuditPage.searchMould['search_button_loc']) base.staleness_of(houseAuditPage.searchMould['tr_house']) base.script('$("#audit_btn").click()') base.click(houseAuditPage.houseAuditPageloc['cancel_btn']) # 审核通过 for i in range(5): try: base.click( houseAuditPage. houseAuditPageloc['iszCommonWorkflowPageSure']) # 确定 break except: base.click( houseAuditPage.houseAuditPageloc['cancel_btn']) # 审核通过 base.check_submit() try: base.solr('house', get_conf('testCondition', 'test')) consoleLog(u'solr的house-core增量成功') except: consoleLog(Exception.message, level='e') consoleLog(u'执行house-core的增量失败,请检查solr是否正常', level='w') pass consoleLog(u'房源 %s审核成功' % address) house = sqlbase.serach( "SELECT residential_id,building_id,unit_id,house_no_id,house_id,house_code from house where property_name like '%s%%' and deleted = 0" % address.encode('utf-8')) set_conf('residential', residentialID=house[0], buildingID=house[1], unitID=house[2], housenoID=house[3]) set_conf('houseInfo', houseID=house[4], houseCode=house[5]) finally: base.driver.quit()
def addHouseContact(): """审核委托合同""" try: base=Base() base.open(page.entrustContractPage, houseContractPage.contractSearchMould['tr_contract'], havaFrame=False) #配置文件读取委托合同信息 contractNum = get_conf('houseContractInfo', 'contractNum');if contractNum!=None:consoleLog(u'配置文件中获得委托合同编号:%s'%contractNum) sql = "SELECT audit_status from house_contract where contract_num = '%s' and deleted = 0" % contractNum.encode('utf-8') if sqlbase.get_count(sql) > 0: if sqlbase.serach(sql)[0] == 'AUDIT': pass else: base.input_text(houseContractPage.houseSearchMould['status'], 'AUDIT')#待审核 base.click(houseContractPage.contractSearchMould['search_button_loc']) base.staleness_of(houseContractPage.contractSearchMould['tr_contract']) contractNum = base.script( "var a = $('[datagrid-row-index=\"0\"] > [field=\"contract_num\"] > div').text();return a", True).decode('utf-8') consoleLog(u'使用随机委托合同:%s 做审核操作' % contractNum, level='w') else: base.input_text(houseContractPage.houseSearchMould['status'], 'AUDIT') base.click(houseContractPage.contractSearchMould['search_button_loc']) base.staleness_of(houseContractPage.contractSearchMould['tr_contract']) contractNum = base.script( "var a = $('[datagrid-row-index=\"0\"] > [field=\"contract_num\"] > div').text();return a", True).decode( 'utf-8') consoleLog(u'使用随机委托合同:%s 做审核操作' % contractNum, level='w') base.input_text(houseContractPage.houseSearchMould['status'], '') base.input_text(houseContractPage.contractSearchMould['contract_num_loc'], contractNum);consoleLog(u'实际审核委托合同编号:%s' % contractNum) base.click(houseContractPage.contractSearchMould['search_button_loc']) base.staleness_of(houseContractPage.contractSearchMould['tr_contract']) base.dblclick(houseContractPage.contractSearchMould['tr_contract'], checkLoc=houseContractPage.addHouseContractMould['contract_num_loc']) # 驳回 base.click(houseContractPage.addHouseContractMould['tab_info_loc'], index=3) base.script('$("button[status=\'REJECTED\']")[1].click()') base.input_text(houseContractPage.addHouseContractMould['contract_audit_content'], u'自动化测试审核数据') base.click(houseContractPage.addHouseContractMould['contract_audit_confirm']) base.staleness_of(houseContractPage.contractSearchMould['tr_contract']) base.dblclick(houseContractPage.contractSearchMould['tr_contract'], checkLoc=houseContractPage.addHouseContractMould['contract_num_loc']) # 审核租金 base.click(houseContractPage.addHouseContractMould['tab_info_loc'], index=1) base.click(houseContractPage.addHouseContractMould['rent_detail_selectAll']) base.click(houseContractPage.addHouseContractMould['rent_audit_loc']) base.click(houseContractPage.addHouseContractMould['audit_pass_loc']) base.click(houseContractPage.addHouseContractMould['rent_audit_confirm']) # 初审 base.click(houseContractPage.addHouseContractMould['tab_info_loc'], index=3) base.script('$("button[status=\'PASS\']")[2].click()') base.click(houseContractPage.addHouseContractMould['contract_audit_confirm']) base.staleness_of(houseContractPage.contractSearchMould['tr_contract']) base.dblclick(houseContractPage.contractSearchMould['tr_contract'], checkLoc=houseContractPage.addHouseContractMould['contract_num_loc']) # 复审 base.click(houseContractPage.addHouseContractMould['tab_info_loc'], index=3) base.script('$("button[status=\'APPROVED\']")[1].click()') base.click(houseContractPage.addHouseContractMould['contract_audit_confirm']) base.check_submit() consoleLog(u'委托合同:%s 审核成功' % contractNum) finally: base.driver.quit()
def auditApartmentContract(): """删除核出租合同终止结算""" try: base = Base() base.open(page.contractEndPage, apartmentContractEndPage.searchMould['tr_contract_end'], havaFrame=False) contractNum = get_conf('apartmentContractInfo', 'contractnum') sql = "SELECT * from apartment_contract where contract_num = '%s' and deleted = 0 and contract_status != 'EFFECTIVE'" % contractNum.encode( 'utf-8') if sqlbase.get_count(sql) > 0: base.input_text( apartmentContractEndPage.searchMould['contract_num_loc'], contractNum) else: consoleLog(u'未找到出租合同终止结算的测试数据,跳过删除用例', level='w') return base.click(apartmentContractEndPage.searchMould['search_button_loc']) base.staleness_of( apartmentContractEndPage.searchMould['tr_contract_end']) base.click( apartmentContractEndPage.addContractEndMould['delete_button']) base.click(apartmentContractEndPage. addContractEndMould['delete_button_confirm']) base.check_submit() consoleLog(u'出租合同 %s 终止结算删除成功' % contractNum) finally: base.driver.quit()
def addHouseContact(): """审核委托合同""" try: base = Base() base.open(page.entrustContractPage, houseContractPage.contractSearchMould['tr_contract'], havaFrame=False) #配置文件读取合同编号 contractNum = get_conf('houseContractInfo', 'contractNum') sql = "SELECT * from house_contract WHERE contract_num = '%s' and deleted = 0" % contractNum.encode( 'utf-8') if sqlbase.get_count(sql) != 0: base.input_text( houseContractPage.contractSearchMould['contract_num_loc'], contractNum) base.click( houseContractPage.contractSearchMould['search_button_loc']) base.staleness_of( houseContractPage.contractSearchMould['tr_contract']) base.click( houseContractPage.addHouseContractMould['delete_button']) base.click(houseContractPage. addHouseContractMould['delete_button_confirm']) base.check_submit() consoleLog(u'委托合同删除成功') else: consoleLog(u'未找到委托合同 %s,略过删除功能' % contractNum) finally: base.driver.quit()
def orderNum(orderIdOrNum): order_id = sqlbase.serach( "select order_id from %s.repairs_order where (order_id='%s' or order_no='%s') and deleted=0" % (get_conf('db', 'rsm_db'), orderIdOrNum, orderIdOrNum)) if order_id: return order_id[0] else: consoleLog(u'报修订单不存在!')
def config_suppliers(self): """订单所有物品供应商id""" sql = "select distinct supplier_id from %s.new_stuff_list where project_id='%s' and deleted=0" % ( get_conf('db', 'decoration_db'), self.project_id) supplier_ids = Mysql().getAll(sql) if not supplier_ids: consoleLog(u'订单配置供应商不存在') return supplier_ids
def property_acceptance(self): """ 物业交割验收 :return: """ base.consoleLog('物业交割验收') idCardPhotos = interface.upLoadPhoto(self.url, base.get_conf('Img', 'picture_name'), base.get_conf('Img', 'file_path'), value='rsm') url = 'http://decorate.ishangzu.com/isz_decoration/NewDecorationProjectController/proCheck/profee' data = { "air_switch": "", "door_card": "", "door_key": "", "electricity_card": "", "electricity_meter_num": "", "electricity_meter_remain": "", "gas_card": "", "gas_meter_num": "", "gas_meter_remain": "", "project_id": self.project_id, "water_card": "", "water_card_remain": "", "water_meter_num": "", "attachments": [{ "attach_type": "PROPERTY_DELIVERY_ORDER", "imgs": [{ "url": idCardPhotos['src'], "img_id": idCardPhotos['img_id'], "create_name": "", "create_dept": "", "create_time": "", "sort": 0, "type": "" }] }], "resource": "PROJECT_CHECK" } result = interface.myRequest(url, data) if result['code'] != 0: base.consoleLog('物业交割确认接口执行失败!') return result['msg'] base.consoleLog('物业交割确认接口执行成功!') return
def upLoadPhoto(url, filename, filepath=None, name='file'): """ 上传图片 :param filepath:'C:\Users\user\Desktop\Image\\' 所在文件夹路径 :param filename:文件名称 :param name:请求文件类型 :param url:上传地址 """ image = Image() if not filepath: filepath = sys.path[1] + '\img\\' filepath_l = filepath + filename if not os.path.exists(filepath_l): consoleLog('文件路径不存在,文件路径:%s' % filepath_l) try: filetype = { name: (str(filename).encode('utf-8'), open(str(filepath_l).encode('utf-8'), 'rb'), 'image/png'), } cookie = eval(get_conf('cookieInfo', 'cookies')) if url.find('http://decorationapp.ishangzu.com/') >= 0: cookie = eval(get_conf('cookieInfo', 'decorationapp_cookies')) request = requests.post(url=url, files=filetype, cookies=cookie) result = json.loads(request.text) if result['code'] is 200 or result[ 'code'] == u'200' or result['code'] is 0: for key, value in result['obj'].items(): if 'img_id' == key: image.id = value if 'src' == key: image.src = value image.url = value if 'url' in key or 'photoUrl' == key: image.url = value image.src = value else: msg = result['msg'].encode('utf-8') if '登陆' in msg: if url.find('http://decorationapp.ishangzu.com/') >= 0: Decoration.decorationAppLogin() login() return upLoadPhoto(url, filename, filepath, name) else: consoleLog( u'上传文件接口异常!\n接口地址:%s\n请求参数:%s\n返回结果:%s\n返回默认图片' % (url, filetype, msg.decode('utf-8')), 'w') image.url = get_conf('img', 'url') image.src = get_conf('img', 'src') image.id = get_conf('img', 'img_id') except Exception as e: consoleLog(e.args, 'e') image.url = get_conf('img', 'url') image.src = get_conf('img', 'src') image.id = get_conf('img', 'img_id') return image
def searchByInfoId(info_id): """根据info_id查询工程订单 :param info_id :return 工程订单对象 """ sql = "select contract_id from %s.decoration_house_info where info_id='%s' and deleted=0" % ( get_conf('db', 'decoration_db'), info_id) contract_id = Mysql().getOne(sql)[0] return DecorationProjectInfo(contract_id)
def searchByProjectId(project_id): """根据project_id查询工程订单 :param project_id :return 工程订单对象 """ sql = "select info_id from %s.new_decoration_project where project_id='%s' and deleted=0" % ( get_conf('db', 'decoration_db'), project_id) info_id = Mysql().getOne(sql)[0] return DecorationProjectInfo.searchByInfoId(info_id)
def addReimbursement(): """新增报销单""" try: base = Base() base.open(page.apartmentPage, apartmentPage.apartmentMould['tr_apartment']) # 配置文件中读取房源 apartmentCode = get_conf('houseInfo', 'apartmentcode') consoleLog(u'确认房源 %s 是否存在' % apartmentCode) sql = "SELECT * from apartment where apartment_code = '%s' and deleted = 0 and is_active = 'Y'" % apartmentCode.encode( 'utf-8') if sqlbase.get_count(sql) > 0: base.input_text(apartmentPage.apartmentMould['residential_name'], apartmentCode) else: sql = "SELECT apartment_code from apartment where deleted = 0 and is_active = 'Y' and city_code = '330100' LIMIT 1" apartmentCode = sqlbase.serach(sql)[0] base.input_text(apartmentPage.apartmentMould['residential_name'], apartmentCode) base.click(apartmentPage.apartmentMould['search_btn']) base.staleness_of(apartmentPage.apartmentMould['tr_apartment']) base.click(apartmentPage.apartmentMould['details_btn']) base.click(apartmentPage.apartmentMould['expense_btn']) # 报销费用 base.input_text(apartmentPage.apartmentMould['memo'], u'报销单自动化测试备注') base.type_select(apartmentPage.typeMould['item_type'], 'WATER') base.type_select(apartmentPage.typeMould['bear_type'], 'COMPANY') base.input_text(apartmentPage.apartmentMould['amount'], '666') base.type_date(apartmentPage.typeMould['start_date'], u'2017-08-08') base.type_date(apartmentPage.typeMould['end_date'], u'2017-08-28') base.type_select(apartmentPage.typeMould['vacant'], 'Y') base.type_select(apartmentPage.typeMould['first'], 'Y') base.type_select(apartmentPage.typeMould['source_bear_id'], 'AutoTest-13666666665') # 报销人 base.type_select(apartmentPage.typeMould['moneytype'], 'CUSTOMER_AGENT_PYMENT') base.type_select(apartmentPage.typeMould['customer_name'], 'AutoTest') base.type_select(apartmentPage.typeMould['customer_bank_location'], 'ABC') base.type_select(apartmentPage.typeMould['bank_card'], '6228481561239334717') # base.input_text(base.apartmentMould['brepay_company'],u'杭州爱上租科技有限公司') base.click(apartmentPage.apartmentMould['submit_btn']) base.check_submit() consoleLog(u'房源 %s 的报销单新增成功' % apartmentCode) sql = "SELECT expense_num from reimbursement_expense where apartment_id = (SELECT apartment_id from apartment where apartment_code = '%s')" % apartmentCode.encode( 'utf-8') consoleLog(u'记录房源 %s 的报销编号' % apartmentCode) num = sqlbase.serach(sql)[0] #写入配置文件 set_conf('houseInfo', apartmentReimbursementNum=num) finally: base.driver.quit()
def add_customer(self): """ 新增租客 :return: """ base.consoleLog('新增租客,手机号码:' + self.phone) rent_date = str(time.strftime('%Y-%m-%d', time.localtime(time.time()))) url = "http://isz.ishangzu.com/isz_customer/CustomerController/saveCustomer.action" data = { "customer_name": "crazytest", "phone": self.phone, "customer_status": "EFFECTIVE", "email": "*****@*****.**", "belong_did": base.get_conf("loginUser", "dep_id"), "belong_uid": base.get_conf("loginUser", "user_id"), "customer_from": "GANJICOM", "rent_class": "NOCLASS", "rent_type": "GATHERHOUSE", "rent_use": "RESIDENCE", "rent_fitment": "FITMENT_SIMPLE", "city_code": "330100", "rent_area_code": "330102", "rent_business_circle_ids": "35", "rent_rooms": "1", "rent_livings": "1", "rent_bathrooms": "1", "rent_from_price": "0.00", "rent_to_price": "6000.00", "rent_date": rent_date, "rent_people": "1", "area": "40", "gender": "MALE", "marriage": "UNMARRIED", "submit_channels": "ERP" } #新增租客 result = interface.myRequest(url, data) if result['code'] != 0: base.consoleLog('新增租客接口执行失败!') return result['msg'] base.consoleLog('新增租客接口执行成功!') return
def volume_room(self): """ 量房评分 :return: """ base.consoleLog('量房评分') url = "http://decorate.ishangzu.com/isz_decoration/NewDecorationProjectController/survey/score" idCardPhotos = interface.upLoadPhoto(self.url, base.get_conf('Img', 'picture_name'), base.get_conf('Img', 'file_path'),value='rsm') data = { "grade": "3", "project_id": self.project_id, "reform_way_fact": "REFORM", "score_remark": "", "attachments": [{ "attach_type": "TOILET", "imgs": [] }, { "attach_type": "KITCHEN", "imgs": [] }, { "attach_type": "LIVING_ROOM", "imgs": [] }, { "attach_type": "ROOM", "imgs": [] }, { "attach_type": "OTHER", "imgs": [{ "url": idCardPhotos['src'], "img_id": idCardPhotos["img_id"], "create_name": "", "create_dept": "", "create_time": "", "sort": 0, "type": "OTHER" }] }]} result = interface.myRequest(url, data) if result['code'] != 0: base.consoleLog('量房接口执行失败!') return result['msg'] base.consoleLog('量房接口执行成功!') return
def __init__(self, residential_name, source='转介绍', room_number=1): """ 初始化开发房源对象值 :param residential_name: 楼盘名称 :param room_number: 新增房间数量 :param source: 房屋来源 """ self.residential_name = residential_name self.room_number = room_number self.source = base.get_conf('house', source)
def zones(self): sql = "select zone_id from %s.funcation_zone where info_id='%s' and deleted=0" % ( get_conf('db', 'decoration_db'), self.info_id) zone_ids = Mysql().getAll(sql) zones = [] if zone_ids: for zone_id in zone_ids: zones.append(self.Zone(zone_id)) else: consoleLog(u'房屋未分割') return zones
class User(Enum): """登录用户信息""" exhouseSql = Mysql().getAll( "select a.user_name,a.user_id,a.dep_id,b.dep_name from sys_user a inner join sys_department b on a.dep_id=b.dep_id " "where a.user_phone='%s' and a.user_status='INCUMBENCY'" % get_conf('sysUser', 'userphone'))[0] UID = exhouseSql[1] DID = exhouseSql[2] NAME = exhouseSql[0] D_NAME = exhouseSql[3]
def auditReimbuisement(): """审核报销单""" try: base=Base() base.open(page.reimbursementExpenseListPage, reimbuisementPage.searchMould['tr_reimbuisement'], havaFrame=False) #配置文件读取报销单信息 expenseNum = get_conf('houseInfo', 'apartmentReimbursementNum') sql = "SELECT * from reimbursement_expense where expense_num = '%s' and deleted = 0" % expenseNum.encode( 'utf-8') consoleLog(u'查询是否存在测试房源的报销单') if sqlbase.get_count(sql) > 0: base.input_text(reimbuisementPage.searchMould['expenseNum_loc'], expenseNum) else: sql = "SELECT rr.expense_num from reimbursement_expense rr INNER JOIN house hh on rr.house_id = hh.house_id where hh.city_code = 330100 " \ "and rr.deleted = 0 and rr.audit_status = 'NO_AUDIT' limit 1" consoleLog(u'未找到测试房源的报销单,随机查找报销单做审核操作') if sqlbase.get_count(sql) > 0: expenseNum = sqlbase.serach(sql)[0] base.input_text(reimbuisementPage.searchMould['expenseNum_loc'], expenseNum);consoleLog(u'输入报销单:%s' % expenseNum) else: consoleLog(u'未找到符合条件的报销单,跳过审核用例') return base.click(reimbuisementPage.searchMould['search_button']) base.staleness_of(reimbuisementPage.searchMould['tr_reimbuisement']) base.dblclick(reimbuisementPage.searchMould['tr_reimbuisement']) base.click(reimbuisementPage.editMould['bohui_loc']) base.input_text(reimbuisementPage.editMould['audit_content'], 'AutoTest') base.click(reimbuisementPage.editMould['audit_confirm']) base.staleness_of(reimbuisementPage.searchMould['tr_reimbuisement']) base.dblclick(reimbuisementPage.searchMould['tr_reimbuisement']) base.click(reimbuisementPage.editMould['chushen_loc']) base.click(reimbuisementPage.editMould['audit_confirm']) base.staleness_of(reimbuisementPage.searchMould['tr_reimbuisement']) base.dblclick(reimbuisementPage.searchMould['tr_reimbuisement']) base.click(reimbuisementPage.editMould['fushen_loc']) base.click(reimbuisementPage.editMould['audit_confirm']) base.check_submit() base.click(reimbuisementPage.editMould['payment_button'], index=0) base.click(reimbuisementPage.editMould['payment_type'], index=0) base.input_text(reimbuisementPage.editMould['payment_remark'], 'AutoTest') base.click(reimbuisementPage.editMould['payment_save']) base.staleness_of(reimbuisementPage.searchMould['tr_reimbuisement']) base.dblclick(reimbuisementPage.searchMould['tr_reimbuisement']) base.click(reimbuisementPage.editMould['payment_audit']) base.click(reimbuisementPage.editMould['payment_audit_save']) consoleLog(u'报销单 %s 审核成功' % expenseNum) finally: base.driver.quit()
def update(self): """更新订单部分字段""" sql = "select * from %s.new_decoration_project where info_id='%s' " % ( get_conf('db', 'decoration_db'), self.info_id) newInfo = Mysql().query(sql)[0] self.config_order_no = newInfo['config_order_no'] self.one_level_nodes = newInfo['one_level_nodes'] self.place_order_date = newInfo['place_order_date'] self.config_submit_uid = newInfo['config_submit_uid'] self.config_submit_uname = newInfo['config_submit_uname'] self.construct_uid = newInfo['construct_uid'] self.construct_uname = newInfo['construct_uname'] self.closed_water_test_result = newInfo['closed_water_test_result'] self.complete_two_nodes = newInfo['complete_two_nodes'] self.config_list_status = newInfo['config_list_status'] self.config_progress = newInfo['config_progress'] self.current_one_node = newInfo['current_one_node']
def __init__(self, zone_id): sql = "select * from %s.funcation_zone where zone_id='%s' and deleted=0" % ( get_conf('db', 'decoration_db'), zone_id) self.zone_id = zone_id self.zone_info = Mysql().query(sql[0]) self.zone_type = self.zone_info['zone_type'] self.room_no = self.zone_info['room_no'] self.usearea = self.zone_info['usearea'] self.zone_orientation = self.zone_info['zone_orientation'] self.have_toilet = self.zone_info['have_toilet'] self.toilet_area = self.zone_info['toilet_area'] self.have_balcony = self.zone_info['have_balcony'] self.balcony_area = self.zone_info['balcony_area'] self.window_area = self.zone_info['window_area'] self.window_type = self.zone_info['window_type'] self.zone_status = self.zone_info['zone_status'] self.is_fictitious_room = self.zone_info['is_fictitious_room']
def deleteReimbuisement(): """删除报销单""" try: base = Base() base.open(page.reimbursementExpenseListPage, reimbuisementPage.searchMould['tr_reimbuisement'], havaFrame=False) #配置文件读取报销单信息 expenseNum = get_conf('houseInfo', 'apartmentReimbursementNum') sql = "SELECT * from reimbursement_expense where expense_num = '%s' and deleted = 0" % expenseNum.encode( 'utf-8') consoleLog(u'查询是否存在测试房源的报销单') if sqlbase.get_count(sql) > 0: base.input_text(reimbuisementPage.searchMould['expenseNum_loc'], expenseNum) else: sql = "SELECT rr.expense_num from reimbursement_expense rr INNER JOIN house hh on rr.house_id = hh.house_id where hh.city_code = 330100 " \ "and rr.deleted = 0 limit 1" consoleLog(u'未找到测试房源的报销单,随机查找报销单做删除操作') if sqlbase.get_count(sql) > 0: expenseNum = sqlbase.serach(sql)[0] base.input_text( reimbuisementPage.searchMould['expenseNum_loc'], expenseNum) else: consoleLog(u'未找到符合条件的报销单,跳过删除用例') return base.click(reimbuisementPage.searchMould['search_button']) base.staleness_of(reimbuisementPage.searchMould['tr_reimbuisement']) base.click(reimbuisementPage.editMould['reset_button']) base.click(reimbuisementPage.editMould['alert_confirm']) base.check_submit() base.dblclick(reimbuisementPage.searchMould['tr_reimbuisement']) base.click(reimbuisementPage.editMould['fanshen_loc']) base.input_text(reimbuisementPage.editMould['audit_content'], 'AutoTest') base.click(reimbuisementPage.editMould['audit_confirm']) base.check_submit() base.click(reimbuisementPage.editMould['delete_button']) base.click(reimbuisementPage.editMould['alert_confirm']) consoleLog(u'报销单 %s 删除成功' % expenseNum) finally: base.driver.quit()
def auditApartmentContract(): """审核出租合同终止结算""" try: base=Base() base.open(page.contractEndPage, apartmentContractEndPage.searchMould['tr_contract_end'], havaFrame=False) #配置文件读取出租合同终止结算信息 contractNum = get_conf('apartmentContractInfo', 'contractnum') sql = "SELECT * from apartment_contract where contract_num = '%s' and deleted = 0 and contract_status != 'EFFECTIVE'" % contractNum.encode( 'utf-8') if sqlbase.get_count(sql) > 0: base.input_text(apartmentContractEndPage.searchMould['contract_num_loc'], contractNum) else: sql = "SELECT contract_num from apartment_contract act inner join apartment_contract_end ace on act.contract_id = ace.contract_id where ace.deleted = 0 " \ "and act.city_code = 330100 and ace.audit_status = 'NO_AUDIT' and act.contract_type = 'NEWSIGN' and act.entrust_type = 'SHARE' limit 1" if sqlbase.get_count(sql) > 0: contractNum = sqlbase.serach(sql)[0] consoleLog(u'未找到测试合同,随机使用合同 %s 做审核终止结算用例' % contractNum, level='w') base.input_text(apartmentContractEndPage.searchMould['contract_num_loc'], contractNum) set_conf('apartmentContractInfo', contractnum=contractNum) else: consoleLog(u'未找到符合条件的可以做终止的出租合同,跳过出租合同终止步骤', level='w') return base.click(apartmentContractEndPage.searchMould['search_button_loc']) base.staleness_of(apartmentContractEndPage.searchMould['tr_contract_end']) base.dblclick(apartmentContractEndPage.searchMould['tr_contract_end']) # 驳回 base.click(apartmentContractEndPage.addContractEndMould['bohui_loc']) base.input_text(apartmentContractEndPage.addContractEndMould['contract_audit_content'], u'自动化测试审核数据') base.click(apartmentContractEndPage.addContractEndMould['contract_audit_confirm']) base.staleness_of(apartmentContractEndPage.searchMould['tr_contract_end']) # 初审 base.dblclick(apartmentContractEndPage.searchMould['tr_contract_end']) base.click(apartmentContractEndPage.addContractEndMould['chushen_loc']) base.click(apartmentContractEndPage.addContractEndMould['contract_audit_confirm']) base.staleness_of(apartmentContractEndPage.searchMould['tr_contract_end']) base.dblclick(apartmentContractEndPage.searchMould['tr_contract_end']) # 复审 base.click(apartmentContractEndPage.addContractEndMould['fushen_loc']) base.click(apartmentContractEndPage.addContractEndMould['contract_audit_confirm']) consoleLog(u'出租合同 %s 终止结算审核成功' % contractNum) finally: base.driver.quit()
def __init__(self, orderNumOrId): sql = "select * from %s.repairs_order where (order_no='%s' or order_id='%s') and deleted=0" % ( get_conf('db', 'rsm_db'), orderNumOrId, orderNumOrId) self.repairs_order_info = Mysql().query(sql)[0] self.order_id = self.repairs_order_info['order_id'] self.order_no = self.repairs_order_info['order_no'] self.apartment_id = self.repairs_order_info['apartment_id'] self.apartment_type = self.repairs_order_info['apartment_type'] self.rent_status = self.repairs_order_info['rent_status'] self.rent_type = self.repairs_order_info['rent_type'] self.house_id = self.repairs_order_info['house_id'] self.room_id = self.repairs_order_info['room_id'] self.apartment_contract_id = self.repairs_order_info[ 'apartment_contract_id'] self.apartment_contract_num = self.repairs_order_info[ 'apartment_contract_num'] self.customer_id = self.repairs_order_info['customer_id'] self.house_contract_id = self.repairs_order_info['house_contract_id'] self.house_address = self.repairs_order_info['house_address'] self.customer_phone = self.repairs_order_info['customer_phone']
def __init__(self, contractNumOrId): super(DecorationProjectInfo, self).__init__(contractNumOrId) sql = "select * from %s.new_decoration_project where info_id='%s' " % ( get_conf('db', 'decoration_db'), self.info_id) self.project_info = Mysql().query(sql, resarch=True)[0] self.project_id = self.project_info['project_id'] self.project_no = self.project_info['project_no'] self.config_order_no = self.project_info['config_order_no'] self.one_level_nodes = self.project_info['one_level_nodes'] self.place_order_date = self.project_info['place_order_date'] self.config_submit_uid = self.project_info['config_submit_uid'] self.config_submit_uname = self.project_info['config_submit_uname'] self.construct_uid = self.project_info['construct_uid'] self.construct_uname = self.project_info['construct_uname'] self.closed_water_test_result = self.project_info[ 'closed_water_test_result'] self.complete_two_nodes = self.project_info['complete_two_nodes'] self.config_list_status = self.project_info['config_list_status'] self.config_progress = self.project_info['config_progress'] self.current_one_node = self.project_info['current_one_node']
def deleteHouseContractEnd(): """删除委托合同终止结算""" try: base = Base() base.open( page.contractEndPage, houseContractEndPage.searchMould['contract_search_button_loc'], havaFrame=False) base.click(houseContractEndPage.addContractEndMould['tab_info'], index=1) #配置文件读取待审核的委托合终止结算 contractNum = get_conf('houseContractInfo', 'contractnum') consoleLog(u'查询委托合同 %s 是否存在终止结算' % contractNum) sql = "SELECT * from house_contract where contract_num = '%s' and deleted = 0 and audit_status = 'APPROVED' and contract_status != 'EFFECTIVE'" % contractNum.encode( 'utf-8') if sqlbase.get_count(sql) > 0: base.input_text( houseContractEndPage.searchMould['end_contract_num_loc'], contractNum) base.click( houseContractEndPage.searchMould['end_search_button_loc']) base.staleness_of( houseContractEndPage.searchMould['tr_contract_end']) else: base.click( houseContractEndPage.searchMould['end_search_button_loc']) base.staleness_of( houseContractEndPage.searchMould['tr_contract_end']) contractNum = base.script( "var a = $('#ContractReceivable_table_wt > div:nth-child(1) > div:nth-child(2) > div.datagrid-view > div.datagrid-view2 > div.datagrid-body > " "table > tbody > tr:nth-child(1) > td[field=\"contract_num\"] > div').text();return a", True).decode('utf-8') consoleLog(u'未找到测试合同的终止结算,随机删除委托合同 %s 的终止结算' % contractNum) base.click(houseContractEndPage.addContractEndMould['delete_button']) base.click( houseContractEndPage.addContractEndMould['delete_button_confirm']) base.check_submit() consoleLog(u'委托合同 %s 终止结算删除成功' % contractNum) finally: base.driver.quit()
def deleteApartmentContract(): """删除出租合同""" try: base=Base() base.open(page.apartmentContractPage, apartmentContractPage.searchContractMould['tr_contract'], havaFrame=False) #配置文件读取合同编号信息 contractNum = get_conf('apartmentContractInfo', 'contractnum') sql = "SELECT * from apartment_contract where contract_num = '%s' and deleted = 0" % contractNum.encode('utf-8') if sqlbase.get_count(sql) > 0: base.input_text(apartmentContractPage.searchContractMould['contract_num_loc'], contractNum.decode('utf-8')) base.click(apartmentContractPage.searchContractMould['search_button_loc']) base.staleness_of(apartmentContractPage.searchContractMould['tr_contract']) base.script("$('#data_perm_btn').click()") base.click(apartmentContractPage.addApartmentContractMould['delete_button_confirm']) base.check_submit() consoleLog(u'出租合同 %s 删除成功' % contractNum) else: consoleLog(u'未找到出租合同 %s ,跳过删除用例' % contractNum) finally: base.driver.quit()
def deleteCustomer(): """删除租前客户信息""" try: base=Base() base.open(page.customerListPage, customerPage.listMould['tr_customer'], havaFrame=False) #配置文件中读取租前客户信息 customerName = get_conf('customerInfo', 'customerName') sql = "SELECT * from customer where customer_name = '%s' and deleted = 0" % customerName.encode('utf-8') if sqlbase.get_count(sql) > 0: base.input_text(customerPage.listMould['customer_name_search'], customerName) base.click(customerPage.listMould['search_button']) base.staleness_of(customerPage.listMould['tr_customer']) base.click(customerPage.listMould['delete_button']) base.click(customerPage.listMould['alert_confirm']) base.check_submit() consoleLog(u'租前客户 %s 删除成功' % customerName) else: consoleLog(u'未找到租前客户 %s,跳过删除' % customerName) finally: base.driver.quit()
def __init__(self, contractNumOrId): sql = "select * from %s.decoration_house_info where (contract_num='%s' or contract_id='%s') and deleted=0" % ( get_conf('db', 'decoration_db'), contractNumOrId, contractNumOrId) self.decoration_house_info = Mysql().query(sql, resarch=True)[0] self.info_id = self.decoration_house_info['info_id'] self.house_code = self.decoration_house_info['house_code'] self.house_id = self.decoration_house_info['house_id'] self.build_area = self.decoration_house_info['build_area'] self.entrust_type = self.decoration_house_info['entrust_type'] self.address = self.decoration_house_info['address'] self.contract_id = self.decoration_house_info['contract_id'] self.contract_num = self.decoration_house_info['contract_num'] self.contract_type = self.decoration_house_info['contract_type'] self.create_time = self.decoration_house_info['create_time'] self.create_uid = self.decoration_house_info['create_uid'] self.entrust_end_date = self.decoration_house_info['entrust_end_date'] self.entrust_start_date = self.decoration_house_info[ 'entrust_start_date'] self.housekeep_mange_uid = self.decoration_house_info[ 'housekeep_mange_uid'] self.city_code = self.decoration_house_info['city_code'] self.city_name = self.decoration_house_info['city_name']
def __getConn(): """ :summary: 静态方法,从连接池中取出连接 :return MySQLdb.connection """ if Mysql.__pool is None: Mysql.__pool = PooledDB(creator=pymysql, mincached=1, maxcached=100, host=get_conf('db', 'host'), port=get_conf('db', 'port', int), user=get_conf('db', 'user'), passwd=get_conf('db', 'password'), db=get_conf('db', 'db'), use_unicode=False, charset=get_conf('db', 'charset')) # cursorclass=DictCursor) # 返回字典格式 return Mysql.__pool.connection()