Exemplo n.º 1
0
    def setUpClass(cls):
        Pylog.info("***************开始执行用例(owner)***************")
        cls.auth = Authors(types="owner")
        cls.config = configutil.Config()

        cls.content = Content(auth=cls.auth)
        cls.order = Order(auth=cls.auth)
        cls.paramConfig = ParamConfig(auth=cls.auth)
        cls.payment = Payment(auth=cls.auth)
        cls.statics = Statics(auth=cls.auth)
        cls.statistics = Statistics(auth=cls.auth)
        cls.uaa = Uaa(auth=cls.auth)
        cls.baseData = BaseData(auth=cls.auth)

        cls.authMember = Authors(types="member")
        cls.ownerAction = OwnerAction(auth=cls.auth, authMember=cls.authMember)
Exemplo n.º 2
0
 def __init__(self, auth=None):
     if auth == None:
         self.auth = Authors(types="owner")
     else:
         self.auth = auth
     self.host = self.auth.config.owner["env"]["host_yz"]
     self.headers = self.auth.headers
Exemplo n.º 3
0
 def setUpClass(cls):
     Pylog.info("***************开始执行用例(member)***************")
     cls.config = globalvars.config()
     cls.loId_list = cls.config.model("member", "lotteryId.json")
     Authors("owner")
     cls.payment = Payment()
     cls.paramconfig = ParamConfig()
     cls.uaa = Uaa()
     cls.memberbet = MemberBet()
     cls.content = Content()
     cls.member = MemberAction()
     cls.membername = "cs_05"
     globalvars.set_value("membername", cls.membername)
Exemplo n.º 4
0
def get_random(lottery=10, playid=None):
    '''
    :param lottery: 彩种ID
    :param playid: 玩法ID
    :return: 所有玩法及内容
    '''
    config = globalvars.config()
    if globalvars.get_value("headers_control") is None:
        Authors(types="control")

    headers = globalvars.get_value("headers_control")
    url_get = "http://{}{}".format(config.owner["control"]["host"],
                                   config.api["control"]["getplays"])
    resp = requests.get(url=url_get,
                        params={
                            "lotteryId": lottery,
                            "playId": playid
                        },
                        headers=headers,
                        timeout=5)
    Pylog.debug("【随机注单-resp】" + resp.text)
    datas = json.loads(resp.text)["data"]
    # Pylog.info("【获取api投注数量(lotteryId:{})】:".format(lottery) + str(len(datas)))
    return datas
Exemplo n.º 5
0
    def __init__(self, auth=None):
        if auth == None:
            self.auth = Authors(types="owner")
        else:
            self.auth = auth
        self.host = self.auth.config.owner["env"]["host_yz"]
        self.headers = self.auth.headers

        self.content = Content(auth=self.auth)
        self.paramConfig = ParamConfig(auth=self.auth)
        self.payment = Payment(auth=self.auth)
        self.uaa = Uaa(auth=self.auth)
        self.statics = Statics(auth=self.auth)

        # 获取会员列表
        tmp = self.uaa.memberList()
        json_dict = json.loads(tmp)

        # 会员名字
        self.username = json_dict['rows'][0]['login']

        # 获取会员信息
        tmp = self.uaa.memberInfo(username=self.username)
        # 获取现有参数
        json_dict = json.loads(tmp)
        # 会员ID
        self.memberId = json_dict['data']['memberId']
        self.email = json_dict['data']['email']
        self.wechat = json_dict['data']['wechat']
        self.qq = json_dict['data']['qq']
        # 会员冻结状态
        self.memberStatus = json_dict['data']['status']
        # 获取已有的会员层级ID
        self.finalMemberLevelID = json_dict['data']['memberLevel']['cid']
        # 获取会员银行信息
        tmp = self.uaa.bank_view(memberId=self.memberId)
        json_dict = json.loads(tmp)
        self.bankCard = json_dict['data']['bankCard']
        self.bankAddress = json_dict['data']['bankAddress']
        self.realName = json_dict['data']['realName']
        self.bankName = json_dict['data']['bankName']

        # 获取retirementId
        self.name = "autoTest" + str(time.time())
        resp = self.paramConfig.retirement_save(param={"name":self.name,"effMemberNum":1,"currentEffBet":100,"currentProfit":100,"itemPO":[{"lotteryId":2,"percentage":0},{"lotteryId":4,"percentage":0},{"lotteryId":6,"percentage":0},{"lotteryId":8,"percentage":0},{"lotteryId":10,"percentage":0},{"lotteryId":12,"percentage":0},{"lotteryId":14,"percentage":0},{"lotteryId":16,"percentage":0},{"lotteryId":18,"percentage":0},{"lotteryId":20,"percentage":0},{"lotteryId":22,"percentage":0},{"lotteryId":24,"percentage":0},{"lotteryId":102,"percentage":0},{"lotteryId":104,"percentage":0},{"lotteryId":106,"percentage":0},{"lotteryId":108,"percentage":0},{"lotteryId":110,"percentage":0}]})
        respDict = json.loads(resp)
        self.retirementId = respDict['data']

        # 获取accessDiscountId
        self.name = "autoTest" + str(time.time())
        resp = self.paramConfig.accessDiscount_save(param={"title":self.name,"dispFee":100,"dispFeeLimit":100,"dispCapped":100,"dispLower":100,"freeCount":1,"repeatFeeCount":1,"dailyAmountLimit":1000000,"itemPO":[{"depositType":1,"ifFirst":1,"ifNormalAudit":1},{"depositType":1,"ifFirst":0,"ifNormalAudit":1},{"depositType":2,"ifFirst":1,"ifNormalAudit":1},{"depositType":2,"ifFirst":0,"ifNormalAudit":1},{"depositType":3,"ifFirst":0}]})
        respDict = json.loads(resp)
        self.accessDiscountId = respDict['data']

        # 获取新增的会员层级的memberLevelId
        self.name = "autoTest" + str(time.time())
        resp = self.uaa.memberLevel_save(accessDiscountId=self.accessDiscountId,rebateProgramId=0,name=self.name)
        respDict = json.loads(resp)
        self.memberLevelId = respDict['data']

        # 获取administrativeId
        self.name = "autoTest" + str(time.time())
        resp = self.paramConfig.administrative_save(cid=None,percentage=100,name=self.name)
        respDict = json.loads(resp)
        self.administrativeId = respDict['data']

        # 获取feePlanId
        self.name = "autoTest" + str(time.time())
        resp = self.paramConfig.feePlan_save(cid=None,name=self.name,depositFeePer=100,depositFeeLimit=100,withdrawalFeePer=100,withdrawalFeeLimit=100)
        respDict = json.loads(resp)
        self.feePlanId = respDict['data']

        # 获取registerDiscountId
        self.name = "autoTest" + str(time.time())
        resp = self.paramConfig.registDiscount_save(name=self.name,discountedPrice=100,auditMultiple=1)
        respDict = json.loads(resp)
        self.registerDiscountId = respDict['data']

        # 获取返水方案id
        # resp = self.payment.mem_cash_back_details(type=2, account=None)
        resp = self.paramConfig.rebateProgram_list(name=None)
        respDict = json.loads(resp)
        self.schemeId = respDict['data']['rows'][0]['cid']

        # 获取代理退佣期号ID
        resp = self.statics.agentPeriod_getSelectList()
        respDict = json.loads(resp)
        self.agentPeriodPcode = respDict['data'][0]['id']

        # 获取收款配置ID
        resp = self.paramConfig.receipt_list()
        respDict = json.loads(resp)
        self.receiptID = respDict['data'][0]['id']

        # 获取收款配置停启用状态
        self.receiptStatus = respDict['data'][0]['status']

        # 获取角色ID
        resp = self.paramConfig.role_list()
        respDict = json.loads(resp)
        self.roleId = respDict['data']['rows'][0]['roleId']

        # 获取角色名称
        resp = self.paramConfig.role_get(roleId=self.roleId)
        dictResp = json.loads(resp)
        self.roleName = dictResp['data']['name']

        # 获取角色描述
        resp = self.paramConfig.role_get(roleId=self.roleId)
        dictResp = json.loads(resp)
        self.roleDescription = dictResp['data']['description']

        # 获取开通的权限
        resp = self.paramConfig.role_get(roleId=self.roleId)
        dictResp = json.loads(resp)
        self.resIds = dictResp['data']['resIds']

        # 获取公司入款账号
        resp = self.paramConfig.income_list(status=None)
        dictResp = json.loads(resp)
        self.incomeID = dictResp['data']['rows'][0]['id']

        # 公司入款账号停启用状态
        self.incomeIdStatus = dictResp['data']['rows'][0]['status']

        # 获取有会员出款的会员名称
        resp = self.payment.draw_list(memberName=None, state=4)
        dictResp = json.loads(resp)
        self.memberNameForDraw = dictResp['data']['rows'][0]['memberName']

        # 获取有公司入款的卡号
        resp = self.payment.offline_statList(endTime= None, startTime= None)
        dictResp = json.loads(resp)
        self.cardNo = dictResp['data']['rows'][1]['cardNo']

        # 获取线上入款的商号和商家名称
        resp = self.payment.online_statList()
        dictResp = json.loads(resp)
        self.merchantNo = dictResp['data']['rows'][0]['merchantNo']
        self.merchantName = dictResp['data']['rows'][0]['merchantName']

        # 获取玩法盈亏pcode
        resp = self.statics.statics_game_per_code(endPdate=1517500799000, startPdate=1517414400000, lotteryIds=2, source=2)
        dictResp = json.loads(resp)
        self.gainlostPcode = dictResp['data']['rows'][0]['pcode']

        # 获取白名单ID
        resp = self.paramConfig.whiteips_list()
        dictResp = json.loads(resp)
        self.whiteipID = dictResp['data']['rows'][0]['id']
        # 获取白名单状态
        self.whiteipStatus = dictResp['data']['rows'][0]['status']
        # 获取白名单域名
        self.whiteipDomain = dictResp['data']['rows'][0]['domain']
        # 获取白名单ip
        self.whiteipIP = dictResp['data']['rows'][0]['ip']
Exemplo n.º 6
0
    def order_repeal(self, memberName):
        '''业主撤单'''
        try:
            repealDict = {}
            flag = "SUCCESS"
            url = "http://" + self.host + "/hermes/apis/order/management/repeal"
            orderlist = self.order_todaylist(memberName)
            orderlist = json.loads(orderlist)["data"]["rows"]
            for i in orderlist:
                repealDict[i["lotteryId"]] = i["orderId"]
            for cid in list(repealDict.values()):
                resp = requests.post(url=url,
                                     headers=self.headers,
                                     params={"orderId": cid},
                                     timeout=15)
                Pylog.debug("【业主撤单-resp】" + resp.text)
                if "true" not in resp.text:
                    flag = "FAIL"
            return flag
        except Exception:
            Pylog.error("【业主撤单错误】:" + Pylog.exinfo())
            return "业主撤单错误"


if __name__ == "__main__":
    Pylog()
    globalvars._init()
    Authors("owner")
    order = Order()
    ss = order.order_repeal("vct_hkjc_02")
    print(ss)
Exemplo n.º 7
0
            Pylog.debug("【会员端展示赔率:】" + str(memberOddDict))
            for odd in list(memberOddDict.keys()):
                if memberOddDict[odd] != controlOddDict[odd]:
                    flag = "FAIL"
            return flag
        except Exception:
            Pylog.error("【校验会员显示赔率错误】:" + Pylog.exinfo())
            return "校验会员显示赔率错误"

    def get_playsTree(self, lotteryId):
        '''获取玩法树'''
        try:
            url = "http://" + self.host + "/forseti/api/playsTree"
            resp = requests.get(url=url, headers=self.headers,
                                params={"lotteryId": lotteryId, "maxUpdateTime": None})
            Pylog.debug("【获取玩法树-resp】:" + str(resp.status_code))
            return resp.text
        except Exception:
            Pylog.error("【获取玩法树错误】:" + Pylog.exinfo())
            return "获取玩法树错误"

if __name__ == "__main__":
    Pylog()
    globalvars._init()
    Authors(types="member")
    Authors(types="control")
    memberBet = MemberBet()
    ss = memberBet.get_playsTree(10)
    print(ss)

Exemplo n.º 8
0
    def setUpClass(cls):
        Pylog.info("***************开始执行用例(CmsProcess)***************")
        cls.auth = Authors(types="member")
        cls.config = globalvars.config()
        cls.paramConfig = paramConfig.ParamConfig()
        cls.content = content.Content()
        cls.memberaction = MemberAction()
        cls.uaa = uaa.Uaa()
        cls.payment = payment.Payment()
        cls.membername = globalvars.get_value("membername")
        owner = cls.config.owner

        #获取图片ID
        actTitlePic = cls.content.upLoadFile('activity.png')
        carouselTitlePic = cls.content.upLoadFile('carousel.png')
        site_iconUrl = cls.content.upLoadFile('H5siteicon.png')
        site_logoUrl = cls.content.upLoadFile('H5sitelogo.png')
        site_h5LogoUrl = cls.content.upLoadFile('H5loginlogo.png')

        #优惠活动参数
        globalvars.set_value(
            "actParam", {
                "title": "自动化测试",
                "weight": "1",
                "titlePic": actTitlePic,
                "content": "<p>自动化测试</p>",
                "beginTime": 1523894400000,
                "endTime": 1523980799000
            })
        globalvars.set_value("actTitle",
                             globalvars.get_value("actParam")['title'])
        globalvars.set_value("actTitlePic",
                             globalvars.get_value("actParam")['titlePic'])
        globalvars.set_value("actContent",
                             globalvars.get_value("actParam")['content'])
        globalvars.set_value("actWeight",
                             globalvars.get_value("actParam")['weight'])

        #轮播图参数
        globalvars.set_value(
            "carouselParam", {
                "beginTime":
                1523894400000,
                "delayTime":
                "1",
                "endTime":
                1523980799000,
                "itemPO": [{
                    "link": "http://www.baidu.com",
                    "titlePic": carouselTitlePic
                }, {
                    "link": "",
                    "titlePic": ""
                }],
                "title":
                "自动化测试"
            })
        globalvars.set_value("carouselTitle",
                             globalvars.get_value("carouselParam")['title'])
        globalvars.set_value(
            "carouselTitlePic",
            globalvars.get_value("carouselParam")['itemPO'][0]['titlePic'])
        globalvars.set_value(
            "carouselDelayTime",
            globalvars.get_value("carouselParam")['delayTime'])
        globalvars.set_value(
            "carouselLink",
            globalvars.get_value("carouselParam")['itemPO'][0]['link'])

        #站点信息参数
        # 查询站点信息
        cls.content.site_view()
        globalvars.set_value(
            "siteParam", {
                "cid": globalvars.get_value("site_cid"),
                "platId": owner["env"]["platId"],
                "iconUrl": site_iconUrl,
                "logoUrl": site_logoUrl,
                "status": 1,
                "h5Name": "自动化测试站点名称",
                "h5SiteUrl": "",
                "h5LogoUrl": site_h5LogoUrl
            })
        globalvars.set_value("site_h5Name",
                             globalvars.get_value("siteParam")['h5Name'])
        globalvars.set_value("site_iconUrl", site_iconUrl)
        globalvars.set_value("site_logoUrl", site_logoUrl)
        globalvars.set_value("site_h5LogoUrl", site_h5LogoUrl)
Exemplo n.º 9
0
from utils import HTMLTestReportCN
from utils.pylog import Pylog
from config import globalvars
from auth.authors import Authors
from suite.process import regProcess, chgoffProcess, chgonProcess, chgsysProcess, drawProcess, betProcess, cmsProcess, \
    ctconfigProcess

params = sys.argv
globalvars._init()
if len(params) > 1:
    globalvars.set_value("membername", params[1])
# globalvars.set_value("membername", "ddee3")
Pylog()
pdate = time.strftime("%Y%m%d", time.gmtime())
globalvars.set_value("pdate", pdate)
Authors("owner")
Authors("control")

suite = unittest.TestSuite()
# suite.addTest(unittest.makeSuite(regProcess.RegProcess))
# suite.addTest(unittest.makeSuite(chgoffProcess.ChgoffProcess))
# suite.addTest(unittest.makeSuite(chgonProcess.ChgonProcess))
# suite.addTest(unittest.makeSuite(chgsysProcess.ChgsysProcess))
# suite.addTest(unittest.makeSuite(drawProcess.DrawProcess))
# suite.addTest(unittest.makeSuite(ctconfigProcess.CtconfigProcess))
# suite.addTest(unittest.makeSuite(betProcess.BetProcess))
suite.addTest(unittest.makeSuite(cmsProcess.CmsProcess))

filename = 'results/report.html'
fp = open(filename, 'wb')
runner = HTMLTestReportCN.HTMLTestRunner(stream=fp,
Exemplo n.º 10
0
            return resp.text
        except Exception:
            Pylog.error("【层级搜索错误】:" + Pylog.exinfo())
            return "层级搜索错误"

    def level_bind_acced(self, levelName, accessDiscountName,
                         accessDiscountId):
        '''层级绑定优惠方案'''
        try:
            url = "http://" + self.host + "/uaa/apis/plat/memberLevel/save"
            datas = self.level_list(levelName)
            datas = json.loads(datas)["data"]["rows"][0]
            datas["accessDiscountName"] = accessDiscountName
            datas["accessDiscountId"] = accessDiscountId
            Pylog.debug("【层级绑定优惠方案-request】" + str(datas))
            resp = requests.post(url=url,
                                 headers=self.headers,
                                 data=json.dumps(datas))
            Pylog.debug("【层级绑定优惠方案-resp】" + str(resp.text))
            return resp.text
        except Exception:
            Pylog.error("【层级绑定优惠方案错误】:" + Pylog.exinfo())
            return "层级绑定优惠方案错误"


if __name__ == "__main__":
    Pylog()
    globalvars._init()
    Authors()
    Uaa().agent_info("leodl")
Exemplo n.º 11
0
            url = "http://" + self.host + "/riskmanagementweb//apis/risk/orderExp/updateOrderExpStatus"
            params = {"lotteryId": cid, "status": status}
            resp = requests.get(url=url, headers=self.headers, params=params, timeout=15)
            Pylog.debug("【异常方案设定停启用-resp】" + resp.text)
            return resp.text
        except Exception:
            Pylog.error("【异常方案设定停启用错误】:" + Pylog.exinfo())
            return "异常方案设定停启用错误"

    def orderExp_statusAll(self, status):
        '''
        :param status: 1停用, 0启用
        :return: 状态
        '''
        try:
            clist = self.orderExp_list()
            clist = json.loads(clist)["data"]["rows"]
            for cid in clist:
                self.orderExp_status(cid["lotteryId"], status)
            return "SUCCESS"
        except Exception:
            Pylog.error("【投注限制全部停启用错误】:" + Pylog.exinfo())
            return "投注限制全部停启用错误"


if __name__ == "__main__":
    Pylog()
    globalvars._init()
    Authors(types="control")
    LotteryConfig().orderExp_statusAll()