def test_resetbag(self,browser,login_m): ''' 重置套餐 ''' frb = FlowCardManage(browser) frb.card_manage.click() frb.flow_card_manage.click() frb.searchiccid=('89860619050008947664') frb.search.click() frb.gouxuankuang.click() frb.resetbag.click() frb.resetbagsave.click() sql = '''select count(iccid) from t_bag_iccid where iccid = '89860619050008947664' ''' count = mq.execQuery(sql) assert count[0][0] == 0
def test_search_by_iccid(self,browser,login_m): ''' 搜索--ICCID ''' iccid = "99999888886666610001" fs=FlowCardManage(browser) fs.card_manage.click() fs.flow_card_manage.click() fs.searchiccid=(iccid) fs.search.click() #结果列表的客户名称 text= fs.s_cusname.text sql='''select t1.customer_name from t_customer t1 left join t_hierarchy t2 on t1.uuid = substring_index( t2.hierarchy_code, "_",- 1 ) WHERE t2.iccid_ = "%s" ''' data = iccid customername = mq.execQuery(sql % data) assert text == customername[0][0]
def test_order_1(self,browser,login_m): ''' 套餐订购--续订生效--单张卡片 ''' #先接口停用卡片 data_stop={ "iccid":"89860619050008947664", "method":"sohan.m2m.iccid.deactivate", "sign":"84FB4DAF697852EDD74E778137EA53D8", "timestamp":"1578385382980", "username":"******" } try: res_stop=api.ask_699(data_stop) print('调用停卡接口成功~~~~ %s' % (res_stop.get('errorCode'))) except: print('接口调用失败!!!!') fob = FlowCardManage(browser) fob.card_manage.click() fob.flow_card_manage.click() fob.searchiccid=(data_stop.get('iccid')) fob.search.click() sleep(1) #勾选第一张卡片89860619050008947664 fob.gouxuankuang.click() #查询该卡现在是否存在生效套餐 sql='''select count(iccid) from t_bag_iccid where iccid = '%s' ''' data=(data_stop.get('iccid')) count = mq.execQuery(sql % data) print('该卡当前存在%s个套餐' % count[0]) print(type(count[0][0])) retry = 2 while count[0][0]: #重置套餐 fob.resetbag.click() fob.resetbagsave.click() fob.gouxuankuang.click() count = mq.execQuery(sql % data) retry-=1 #开始给该卡(无套餐,停用)上套餐 fob.searchcustomer1.click() fob.searchcustomer3.click() fob.orderbag.click() Select(fob.osourcetype).select_by_value("1") fob.obag.click() fob.ochosebag.click() Select(fob.ochosenum).select_by_value('1') fob.osavebag.click() sleep(5) fob.gouxuankuang.click() fob.reflesh.click() #先看104有没有生效套餐 count1 = mq.execQuery(sql % data) assert count1[0][0] == 1 #调用单个卡片查询接口检查是否激活(实际上返回的也是104数据库的字段值) data_qc={"iccid":"89860619050008947664", "method":"sohan.m2m.iccidinfo.queryone", "sign":"E0469BBE55C252734E9EFA82A8F0CDAD", "timestamp":"1578553270141", "username":"******" } try: res_query = api.ask_104(data_qc) print('调用查询接口成功~~~~ %s' % (res_query.get('errorCode'))) dict = res_query.get("data") result = dict.get('cardStatus') assert result == '2' except: print('接口调用失败!!!!')