def test_003_get_film_plan(self): # 所有放映计划列表信息 plan_list = [] url = url_query() client = suds.client.Client(url) xml = OnlineTicketingServiceQuery.film_plan_xml() res = client.service['NetSaleWebServicePort'].query(xml) status = repxml.get_status(res) self.assertEqual(status, 'Success') # 先判断一下是否有放映计划 error_code = repxml.get_error_code(res) if len(error_code) > 0: print(repxml.get_error_message(res)) return plan_list else: # 获取放映计划列表 # 放映计划iD film_planx = repxml.get_value("Code", res) # 因为返回的xml中有两个code,一个是放映计划,一个是影片的code,需要删除影片code film_plan = [] start_time = [] for i in range(len(film_planx)): if len(film_planx[i]) > 12: film_plan.append(film_planx[i]) # 放映计划的影厅 film_hall = repxml.get_screen_code(res) # 影片名称 film_name = repxml.get_value("Name", res) # 放映时间 start_timex = repxml.get_value("StartTime", res) # 调整时间格式 for t in range(len(start_timex)): temp = start_timex[t].replace("T", " ") start_time.append(temp) # 最低票价 lowest_price = repxml.get_value("LowestPrice", res) # 标准票价 standard_price = repxml.get_value("StandardPrice", res) plan_list.append(film_plan) plan_list.append(start_time) plan_list.append(film_hall) plan_list.append(film_name) plan_list.append(lowest_price) plan_list.append(standard_price) # 处理小于当前日期的放映计划 temp = [] for i in range(len(plan_list[0])): if repxml.time_compare(plan_list[1][i]) == 0: temp.append(i) temp.sort() temp.reverse() for p in range(len(plan_list)): for q in range(len(temp)): del plan_list[p][temp[q]] if len(plan_list[0]) == 0: plan_list = [] return plan_list else: return plan_list
def test_005_refund_ticket(self): '''退票接口_ID_RefundTicket''' requestName = get_current_function_name() client = suds.client.Client(self.url) xml = OnlineTicketingServiceQuery_D.refound_ticket(PrintNo, VerifyCode) res = client.service['NetSaleWebServicePort'].query(xml) logger.info(requestName + '--' + repxml.get_keyOfValue("ErrorMessage",res) + "PrintNo" + ':' + PrintNo + "VerifyCode" + ':' + VerifyCode) self.assertEqual(repxml.get_status(res), 'Success')
def test_001_get_film_info(self): '''获取影院信息''' url = url_query() client = suds.client.Client(url) xml = OnlineTicketingServiceQuery.film_info_xml() rp = client.service['NetSaleWebServicePort'].query(xml) print rp status = repxml.get_status(rp) self.assertEqual(status, 'Success')
def test_002_plan_seat_xml(self): '''查询放映计划可用座位_ID_DQuerySessionSeat''' requestName = get_current_function_name() global SeatCode client = suds.client.Client(self.url) xml = OnlineTicketingServiceQuery_D.plan_seat_xml(SessionPlanCode) res = client.service['NetSaleWebServicePort'].query(xml) self.assertEqual(repxml.get_status(res), 'Success') SeatCode = getAvilableSaleSeat(res) logger.info(requestName + '--' + repxml.get_keyOfValue("ErrorMessage", res) + "SeatCode" + ':' + SeatCode)
def test_005_takeTicketConfirm(self): '''取票确认信息接口''' requestName = get_current_function_name() client = suds.client.Client(self.url) xml = OnlineTicketingServiceQuery_D.take_ticket_info( PrintNo, VerifyCode) res = client.service['NetSaleWebServicePort'].query(xml) logger.info(requestName + '--' + repxml.get_keyOfValue("ErrorMessage", res)) status = repxml.get_status(res) self.assertEqual(status, 'Success')
def test_004_release_seat_seatCode(self): '''解锁座位_ID_SubmitOrder''' requestName = get_current_function_name() client = suds.client.Client(self.url) xml = OnlineTicketingServiceQuery_D.release_seat(OrderCode,SessionPlanCode, '9900000100100301') res = client.service['NetSaleWebServicePort'].query(xml) print res logger.info(requestName + '--' + repxml.get_keyOfValue("ErrorMessage", res)) self.assertEqual(repxml.get_status(res), 'Failure') self.assertIn( u'解锁和锁座不是同一个订单号,锁:1809171436220678',repxml.get_keyOfValue("ErrorMessage", res))
def test_003_lock_seat_xml(self): '''锁定座位_ID_DLockSeat''' requestName = get_current_function_name() global OrderCode client = suds.client.Client(self.url) xml = OnlineTicketingServiceQuery_D.lock_seat_xml(SessionPlanCode, SeatCode) res = client.service['NetSaleWebServicePort'].query(xml) OrderCode = repxml.get_keyOfValue("OrderCode", res) logger.info(requestName + '--' + repxml.get_keyOfValue("ErrorMessage", res) + "OrderCode" + ':' + OrderCode) self.assertEqual(repxml.get_status(res), 'Success') self.assertEqual(repxml.get_keyOfValue("ErrorMessage", res), 'NULL')
def test_001_search_show_plan(self): '''查询放映计划_ID_DQuerySession''' global SessionPlanCode requestName = get_current_function_name() client = suds.client.Client(self.url) xml = OnlineTicketingServiceQuery_D.film_plan_xml() res = client.service['NetSaleWebServicePort'].query(xml) self.assertEqual(repxml.get_status(res), 'Success') SessionPlanCode = repxml.get_value("Code", res)[0] logger.info(requestName + '--' + repxml.get_keyOfValue("ErrorMessage", res) + "SessionPlanCode" + ':' + SessionPlanCode)
def test_001_sync_channel_lsit(self): '''同步排期_ID_SyncChannelList''' global SessionPlanCode requestName = get_current_function_name() client = suds.client.Client(self.url) xml = OnlineTicketingServiceQuery_D.sync_channel_list() res = client.service['NetSaleWebServicePort'].query(xml) print res status = repxml.get_status(res) self.assertEqual(status, 'Success') logger.info(requestName + '--' + repxml.get_keyOfValue("ErrorMessage", res))
def test_004_confirmSCTS_order(self): '''确认SCTS订单交易接口_ID_SubmitOrder''' global PrintNo, VerifyCode requestName = get_current_function_name() client = suds.client.Client(self.url) xml = OnlineTicketingServiceQuery_D.order_sure_xml(OrderCode, SessionPlanCode, SeatCode, '50', '40', '10', '3') res = client.service['NetSaleWebServicePort'].query(xml) PrintNo = repxml.get_keyOfValue("PrintNo", res) VerifyCode = repxml.get_keyOfValue("VerifyCode", res) logger.info(requestName + '--' + repxml.get_keyOfValue("ErrorMessage", res)) self.assertEqual(repxml.get_status(res), 'Success')
def test_004_confirmSCTS_order(self): '''解锁座位_ID_SubmitOrder''' requestName = get_current_function_name() client = suds.client.Client(self.url) xml = OnlineTicketingServiceQuery_D.release_seat( OrderCode, SessionPlanCode, SeatCode) res = client.service['NetSaleWebServicePort'].query(xml) logger.info(requestName + '--' + repxml.get_keyOfValue("ErrorMessage", res)) self.assertEqual(repxml.get_status(res), 'Success') self.assertEqual(repxml.get_keyOfValue("ErrorMessage", res), 'NULL')
def test_004_release_seat_seatCode(self): '''解锁座位_ID_SubmitOrder_错误的排期编码''' requestName = get_current_function_name() client = suds.client.Client(self.url) xml = OnlineTicketingServiceQuery_D.release_seat( OrderCode, '5518091700102106', SeatCode) res = client.service['NetSaleWebServicePort'].query(xml) logger.info(requestName + '--' + repxml.get_keyOfValue("ErrorMessage", res)) self.assertEqual(repxml.get_status(res), 'Failure') self.assertIn(repxml.get_keyOfValue("ErrorMessage", res), u'无效的放映计划编码')
def order_sure(): lockseat = lock_seat() if len(lockseat) != 0: url = url_query() client = suds.client.Client(url) xml = OnlineTicketingServiceQuery.order_sure_xml( lockseat[0], lockseat[1], lockseat[2], lockseat[3]) res = client.service['NetSaleWebServicePort'].query(xml) status = repxml.get_status(res) if status == "Success": print("购买1张票成功") else: print(repxml.get_error_message(res))
def test_002_get_cinema_info(self): url = url_query() client = suds.client.Client(url) xml = OnlineTicketingServiceQuery.cinema_info_xml() res = client.service['NetSaleWebServicePort'].query(xml) status = repxml.get_status(res) self.assertEqual(status, 'Success') # 后别这块加一下如果没有影厅的处理 cinema_info = [] cinema_code = repxml.get_value("Code", res) cinema_name = repxml.get_value("Name", res) cinema_info.append(cinema_code) cinema_info.append(cinema_name) return cinema_info
def test_005_refund_ticket(self): '''退票接口_ID_RefundTicket''' requestName = get_current_function_name() client = suds.client.Client(self.url) xml = OnlineTicketingServiceQuery_D.refound_ticket(PrintNo, VerifyCode) res = client.service['NetSaleWebServicePort'].query(xml) logger.info(requestName + '--' + repxml.get_keyOfValue("ErrorMessage", res) + "PrintNo" + ':' + PrintNo + "VerifyCode" + ':' + VerifyCode) status = repxml.get_status(res) self.assertEqual(status, 'Success') # def test_006_refundRecordTicketInfo(self): # '''记录信息''' # currentTime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) # with open('rufundTicketInfo.txt', 'a') as text: # text.write('%s=%s' % ('testcaseTime', currentTime)) # text.write('%s=%s' % ('SessionPlanCode', SessionPlanCode)) # text.write('%s=%s' % ('SeatCode', SeatCode)) # text.write('%s=%s' % ('OrderCode', OrderCode)) # text.write('%s=%s' % ('PrintNo', PrintNo)) # text.write('%s=%s' % ('VerifyCode', VerifyCode)) # text.write("\n")