Ejemplo n.º 1
0
 def test_getCategoryList_beer(self):
     ws = webservice()
     ws.login(self.UserShop.username, self.UserShop.password)
     pijiuList = ws.getCategoryList(merchCategoryCode='C01L0104')
     self.assertEqual(pijiuList.model['success'], '0')
     self.assertEqual(pijiuList.model['categoryCode'], 'C01L0104')
     # 校验品牌数量
     numPijiuBrand = select_int(
         'select count(*) from dlcategroy.dl_brand where brand_id in (select brand_id from dlcategroy.dl_brand_ref_category where category_id = \'C01L0104\' and brand_status = \'01\') and brand_status != \'99\''
     )
     self.assertEqual(
         len(pijiuList.model['categoryItem']['brandTupleList']),
         numPijiuBrand)
     # 校验分类数量
     numPijiuClassify = select_int(
         'select count(*) from dlcategroy.dl_property_value where property_id = \'PL20401\''
     )
     self.assertEqual(
         len(pijiuList.model['categoryItem']['classifyTupleList']),
         numPijiuClassify)
     # 校验国家数量
     numPijiuCountry = select_int(
         'select count(*) from dlcategroy.dl_property_value where property_id = \'PL20402\''
     )
     self.assertEqual(
         len(pijiuList.model['categoryItem']['countryTupleList']),
         numPijiuCountry)
Ejemplo n.º 2
0
    def test_getMerchList_filterTea(self):
        ws = webservice()
        ws.login(self.UserShop.username, self.UserShop.password)
        # 筛选茶
        MerchList = ws.getMerchList(merchCategoryCode='C01T01',rows='999')
        self.assertEqual(MerchList.model['success'], '0')
        flag = False
        for i in range(0,len(MerchList.model['merchList'])):
            if MerchList.model['merchList'][i]['merchName'].encode('utf-8') == self.Merch2.fullName:
                flag = True
        self.assertEqual(flag, True, self.Merch2.fullName + ' is not found')

        # 筛选绿茶——merch为红茶,故判断找不到
        MerchList = ws.getMerchList(merchCategoryCode='C01T0101',rows='999')
        self.assertEqual(MerchList.model['success'], '0')
        for i in range(0,len(MerchList.model['merchList'])):
            if MerchList.model['merchList'][i]['merchName'].encode('utf-8') == self.Merch2.fullName:
                flag = False
        self.assertEqual(flag, True, self.Merch2.fullName + ' is red tea, but can find it in green tea.')

        # 筛选红茶
        MerchList = ws.getMerchList(merchCategoryCode='C01T0102',rows='999')
        self.assertEqual(MerchList.model['success'], '0')
        flag = False
        for i in range(0,len(MerchList.model['merchList'])):
            if MerchList.model['merchList'][i]['merchName'].encode('utf-8') == self.Merch2.fullName:
                flag = True
        self.assertEqual(flag, True, self.Merch2.fullName + ' is not found.')
Ejemplo n.º 3
0
    def test_getRecdMerchList_page(self):
        ws = webservice()
        ws.login(self.UserShop.username, self.UserShop.password)
        allMerchList = ws.getRecommendList(rows='999')
        numMerch = len(allMerchList.model['recommendListModel'])
        page = numMerch / 4

        time = 0
        for p in range(1, page + 2):
            MerchListPage = ws.getRecommendList(page=p)
            # 判断商品1是否存在,如果存在time +1
            for i in range(0, len(MerchListPage.model['recommendListModel'])):
                if MerchListPage.model['recommendListModel'][i][
                        'merchName'].encode('utf-8') == self.Merch1.fullName:
                    time += 1
            if p == page + 1:
                self.assertEqual(
                    len(MerchListPage.model['recommendListModel']),
                    numMerch % 4, "The last page is wrong")
            else:
                self.assertEqual(
                    len(MerchListPage.model['recommendListModel']), 4,
                    "Every page is wrong")

        self.assertEqual(time, 1, self.Merch1.fullName + " is not once.")
Ejemplo n.º 4
0
    def test_getMerchList_null(self):
        # 修改终端店2的采购区域为香港CHNP032C342D2995
        update('update dlcompany.dl_biz_purchase set purchase_area_code = ? where company_id = ?', 'CHNP032C342D2995', self.UserShop2.companyId)

        ws = webservice()
        ws.login(self.UserShop2.username, self.UserShop2.password)
        MerchList = ws.getPromotionList(rows='999')
        self.assertEqual(MerchList.model['promotionListModel'],[])
Ejemplo n.º 5
0
 def test_getMerchDetail_stockout(self):
     ws = webservice()
     ws.login(self.UserShop.username, self.UserShop.password)
     update(
         'update dlmerchandise.dl_goods set on_hand_inventory = 0 where goods_id = ?',
         self.Merch1.goodsId)
     merchDetail = ws.getMerchDetail(merchId=self.Merch1.goodsId)
     self.assertEqual(merchDetail.model['merchDetail']['merchStatus'], '1')
Ejemplo n.º 6
0
 def test_getMerchDetail_lock(self):
     ws = webservice()
     ws.login(self.UserShop.username, self.UserShop.password)
     update(
         'update dlmerchandise.dl_goods set goods_status = \'03\' where goods_id = ?',
         self.Merch1.goodsId)
     merchDetail = ws.getMerchDetail(merchId=self.Merch1.goodsId)
     self.assertEqual(merchDetail.model['merchDetail']['merchStatus'], '2')
Ejemplo n.º 7
0
 def test_modifyPwd_mod(self):
     ws = webservice()
     ws.login(self.UserShop.username, self.UserShop.password)
     modifyPwd = ws.modiyfPassword(self.UserShop.password, 'ModifyPwd')
     self.assertEqual(modifyPwd.model['success'], '0')
     modifyPwdOld = ws.login(self.UserShop.username, self.UserShop.password, 'null')
     self.assertEqual(modifyPwdOld.model['success'], '4')
     modifyPwdNew = ws.login(self.UserShop.username, 'ModifyPwd')
     self.assertEqual(modifyPwdNew.model['success'], '0')
Ejemplo n.º 8
0
 def test_getMerchList_sellerId(self):
     ws = webservice()
     ws.login(self.UserShop.username, self.UserShop.password)
     MerchList = ws.getMerchList(sellerId=self.DealMgr.companyId,rows='999')
     flag = False
     for i in range(0,len(MerchList.model['merchList'])):
         if MerchList.model['merchList'][i]['merchName'].encode('utf-8') == self.Merch2.fullName:
             flag = True
     self.assertEqual(flag, True, self.Merch2.fullName + ' is not found')
Ejemplo n.º 9
0
 def test_getMerchList_all(self):
     ws = webservice()
     ws.login(self.UserShop.username, self.UserShop.password)
     merchList = ws.getPromotionList(rows="999")
     # 商品1存在
     self.assertGetMerchList(merchList, self.Merch1)
     # 商品4不在列表
     for i in range(0, len(merchList.model['promotionListModel'])):
         if merchList.model['promotionListModel'][i] == self.Merch4.goodsId:
             self.assertEqual(False,True,self.fullName + 'is found in PromotionList')
Ejemplo n.º 10
0
 def test_getMerchList_searchName(self):
     ws = webservice()
     ws.login(self.UserShop.username, self.UserShop.password)
     MerchList = ws.getMerchList(merchName=self.Merch1.fullName.encode('utf-8'),rows='999')
     self.assertEqual(MerchList.model['success'], '0')
     flag = False
     for i in range(0,len(MerchList.model['merchList'])):
         if MerchList.model['merchList'][i]['merchName'].encode('utf-8') == self.Merch1.fullName:
             flag = True
     self.assertEqual(flag, True, self.Merch1.fullName + ' is not found')
Ejemplo n.º 11
0
 def test_getCategoryList_tea(self):
     ws = webservice()
     ws.login(self.UserShop.username, self.UserShop.password)
     teaList = ws.getCategoryList(merchCategoryCode='C01T01')
     self.assertEqual(teaList.model['success'], '0')
     self.assertEqual(teaList.model['categoryCode'], 'C01T01')
     # 校验茶类数量
     numTeaClassify = select_int(
         'select count(*) from dlcategroy.dl_category where parent_category_id = \'C01T01\''
     )
     self.assertEqual(len(teaList.model['categoryItem']), numTeaClassify)
Ejemplo n.º 12
0
 def test_getMerchList_all(self):
     ws = webservice()
     ws.login(self.UserShop.username, self.UserShop.password)
     allMerchList = ws.getMerchList(rows='99999')
     self.assertEqual(allMerchList.model['success'], '0')
     #numMerchList = select_int('select count(*) from dl_goods.dl_goods_area_buyer_type where area_code = \'CHNP035C345D2998\' and buyer_type = \'S011\'')
     #self.assertEqual(len(allMerchList.model['merchList']), numMerchList)
     flag = False
     for i in range(0,len(allMerchList.model['merchList'])):
         if allMerchList.model['merchList'][i]['merchName'].encode('utf-8') == self.Merch1.fullName:
             flag = True
     self.assertEqual(flag, True, self.Merch1.fullName + ' is not found')
Ejemplo n.º 13
0
 def test_getCategoryList_drink(self):
     ws = webservice()
     ws.login(self.UserShop.username, self.UserShop.password)
     drinkList = ws.getCategoryList(merchCategoryCode='C01X0101')
     self.assertEqual(drinkList.model['success'], '0')
     self.assertEqual(drinkList.model['categoryCode'], 'C01X0101')
     # 校验茶类数量
     numDrinkBrand = select_int(
         'select count(*) from dlcategroy.dl_brand where brand_id in (select brand_id from dlcategroy.dl_brand_ref_category where category_id = \'C01X0101\' and brand_status = \'01\') and brand_status != \'99\''
     )
     self.assertEqual(
         len(drinkList.model['categoryItem']['brandTupleList']),
         numDrinkBrand)
Ejemplo n.º 14
0
    def test_getMerchList_priceLimitLower(self):
        ws = webservice()
        ws.login(self.UserShop.username, self.UserShop.password)
        MerchList = ws.getMerchList(lowPrice="99900",rows='999')
        flag = False
        # 商品2在价格区间
        for i in range(0,len(MerchList.model['merchList'])):
            if MerchList.model['merchList'][i]['merchName'].encode('utf-8') == self.Merch2.fullName:
                flag = True
        self.assertEqual(flag, True, self.Merch2.fullName + ' is not found')

        # 商品1不在价格区间
        for i in range(0,len(MerchList.model['merchList'])):
            if MerchList.model['merchList'][i]['merchName'].encode('utf-8') == self.Merch1.fullName:
                flag = False
        self.assertEqual(flag, True, self.Merch1.fullName + ' is not found')
Ejemplo n.º 15
0
    def test_getMerchList_filterCategory(self):
        ws = webservice()
        ws.login(self.UserShop.username, self.UserShop.password)
        # 筛选白酒
        MerchList1 = ws.getMerchList(merchCategoryCode='C01L0101',rows='999')
        self.assertEqual(MerchList1.model['success'], '0')
        flag = False
        for i in range(0,len(MerchList1.model['merchList'])):
            if MerchList1.model['merchList'][i]['merchName'].encode('utf-8') == self.Merch1.fullName:
                flag = True
        self.assertEqual(flag, True, self.Merch1.fullName + ' is not found')

        # 筛选葡萄酒
        MerchList2 = ws.getMerchList(merchCategoryCode='C01L0102',rows='999')
        self.assertEqual(MerchList2.model['success'], '0')
        for i in range(0,len(MerchList2.model['merchList'])):
            if MerchList2.model['merchList'][i]['merchName'].encode('utf-8') == self.Merch1.fullName:
                flag = False
        self.assertEqual(flag, True, self.Merch1.fullName + ' is not wine, but can find it.')

        # 筛选洋酒
        MerchList3 = ws.getMerchList(merchCategoryCode='C01L0103',rows='999')
        self.assertEqual(MerchList3.model['success'], '0')
        for i in range(0,len(MerchList3.model['merchList'])):
            if MerchList3.model['merchList'][i]['merchName'].encode('utf-8') == self.Merch1.fullName:
                flag = False
        self.assertEqual(flag, True, self.Merch1.fullName + ' is not foreign wine, but can find it.')

        # 筛选啤酒
        MerchList4 = ws.getMerchList(merchCategoryCode='C01L0104',rows='999')
        self.assertEqual(MerchList4.model['success'], '0')
        for i in range(0,len(MerchList4.model['merchList'])):
            if MerchList4.model['merchList'][i]['merchName'].encode('utf-8') == self.Merch1.fullName:
                flag = False
        self.assertEqual(flag, True, self.Merch1.fullName + ' is not beer, but can find it.')

        # 筛选其他饮品
        MerchList = ws.getMerchList(merchCategoryCode='C01X0101',rows='999')
        self.assertEqual(MerchList.model['success'], '0')
        for i in range(0,len(MerchList.model['merchList'])):
            if MerchList.model['merchList'][i]['merchName'].encode('utf-8') == self.Merch1.fullName:
                flag = False
        self.assertEqual(flag, True, self.Merch1.fullName + ' is not drink, but can find it.')
Ejemplo n.º 16
0
 def test_getCategoryList_wine(self):
     ws = webservice()
     ws.login(self.UserShop.username, self.UserShop.password)
     putaojiuList = ws.getCategoryList(merchCategoryCode='C01L0102')
     self.assertEqual(putaojiuList.model['success'], '0')
     self.assertEqual(putaojiuList.model['categoryCode'], 'C01L0102')
     # 校验品牌数量
     numPutaojiuBrand = select_int(
         'select count(*) from dlcategroy.dl_brand where brand_id in (select brand_id from dlcategroy.dl_brand_ref_category where category_id = \'C01L0102\' and brand_status = \'01\') and brand_status != \'99\''
     )
     self.assertEqual(
         len(putaojiuList.model['categoryItem']['brandTupleList']),
         numPutaojiuBrand)
     # 校验产地
     numPutaojiuProperty = select_int(
         'select count(*) from dlcategroy.dl_property_value where property_id = \'PL20202\''
     )
     self.assertEqual(
         len(putaojiuList.model['categoryItem']['productionTupleList']),
         numPutaojiuProperty)
Ejemplo n.º 17
0
    def test_getNewMerchList_page(self):
        ws = webservice()
        ws.login(self.UserShop.username, self.UserShop.password)
        allMerchList = ws.getNewMerchList(rows='999')
        numMerch = len(allMerchList.model['newMerchListModel'])
        rows = numMerch/15

        time = 0
        for r in range(1,numMerch/15+2):
            MerchListPage = ws.getNewMerchList(page=r)
            # 判断商品1是否存在,如果存在time +1
            for i in range(0,len(MerchListPage.model['newMerchListModel'])):
                if MerchListPage.model['newMerchListModel'][i]['merchName'].encode('utf-8') == self.Merch1.fullName:
                    time+=1
            if r == numMerch/15+1:
                self.assertEqual(len(MerchListPage.model['newMerchListModel']),numMerch%15,"The last page is wrong")
            else:
                self.assertEqual(len(MerchListPage.model['newMerchListModel']),15,"Every page is wrong")

        self.assertEqual(time,1,self.Merch1.fullName+" is not once.")
Ejemplo n.º 18
0
 def test_getCategoryList_sprit(self):
     ws = webservice()
     ws.login(self.UserShop.username, self.UserShop.password)
     baijiuList = ws.getCategoryList()
     self.assertEqual(baijiuList.model['success'], '0')
     self.assertEqual(baijiuList.model['categoryCode'], 'C01L0101')
     # 校验品牌数量dlcategroy
     numBaijiuBrand = select_int(
         'select count(*) from dlcategroy.dl_brand where brand_id in (select brand_id from dlcategroy.dl_brand_ref_category where category_id = \'C01L0101\' and brand_status = \'01\') and brand_status != \'99\''
     )
     self.assertEqual(
         len(baijiuList.model['categoryItem']['brandTupleList']),
         numBaijiuBrand)
     # 校验香型数量
     numBaijiuProperty = select_int(
         'select count(*) from dlcategroy.dl_property_value where property_id = \'PL20103\''
     )
     self.assertEqual(
         len(baijiuList.model['categoryItem']['odorTupleList']),
         numBaijiuProperty)
Ejemplo n.º 19
0
    def test_getOftenMerchList_soldOut(self):
        ws = webservice()
        ws.login(self.UserShop.username, self.UserShop.password)
        update(
            'update dlmerchandise.dl_goods set goods_status = ? where goods_id = ?',
            '02', self.Merch1.goodsId)
        # 获取下架商品,商品1存在
        merchList = ws.getOftenBuyList(saleFlag="1", rows="999")
        # 下架后商品无促销无推荐
        self.assertGetMerchList(merchList,
                                self.Merch1,
                                isPromotion='1',
                                isRecommended='1')

        # 获取上架商品,商品1不在列表
        merchList = ws.getOftenBuyList(saleFlag="1", rows="999")
        for i in range(0, len(merchList.model['oftenBuyListModel'])):
            if merchList.model['oftenBuyListModel'][i] == self.Merch1.goodsId:
                self.assertEqual(
                    False, True,
                    self.Merch1.fullName + 'is found in oftenBuyList')
Ejemplo n.º 20
0
    def test_getMerchList_filterProperty(self):
        ws = webservice()
        ws.login(self.UserShop.username, self.UserShop.password)

        # 筛选白酒香型
        MerchList = ws.getMerchList(merchPropertyValueCodeList=["PL20103_split_PL20103V01_split_酱香型"],rows='999')
        self.assertEqual(MerchList.model['success'], '0')
        flag = False
        for i in range(0,len(MerchList.model['merchList'])):
            if MerchList.model['merchList'][i]['merchName'].encode('utf-8') == self.Merch1.fullName:
                flag = True
        self.assertEqual(flag, True, self.Merch1.fullName + ' is not found')

        # 筛选茶种——祁门红茶
        MerchList = ws.getMerchList(merchCategoryCode="C01T0102",merchPropertyValueCodeList=["PT20201_split_PT20201V01_split_祁门红茶"],rows='999')
        self.assertEqual(MerchList.model['success'], '0')
        flag = False
        for i in range(0,len(MerchList.model['merchList'])):
            if MerchList.model['merchList'][i]['merchName'].encode('utf-8') == self.Merch2.fullName:
                flag = True
        self.assertEqual(flag, True, self.Merch2.fullName + ' is not found')
Ejemplo n.º 21
0
    def test_getMerchList_sort(self):
        ws = webservice()
        ws.login(self.UserShop.username, self.UserShop.password)

        # 名称升序排列
        MerchListNameAsc = ws.getMerchList(sellerId=self.DealMgr.companyId,sortField="0",sortType="0",rows='999')
        self.assertEqual(MerchListNameAsc.model['merchList'][0]['merchName'].encode('utf-8'),self.Merch1.fullName)
        self.assertEqual(MerchListNameAsc.model['merchList'][1]['merchName'].encode('utf-8'),self.Merch2.fullName)

        # 名称降序排列
        MerchListNameDesc = ws.getMerchList(sellerId=self.DealMgr.companyId,sortField="0",sortType="1",rows='999')
        self.assertEqual(MerchListNameDesc.model['merchList'][0]['merchName'].encode('utf-8'),self.Merch2.fullName)
        self.assertEqual(MerchListNameDesc.model['merchList'][1]['merchName'].encode('utf-8'),self.Merch1.fullName)

        # 价格升序排列
        MerchListPriceAsc = ws.getMerchList(sellerId=self.DealMgr.companyId,sortField="1",sortType="0",rows='999')
        self.assertEqual(MerchListPriceAsc.model['merchList'][0]['merchName'].encode('utf-8'),self.Merch1.fullName)
        self.assertEqual(MerchListPriceAsc.model['merchList'][1]['merchName'].encode('utf-8'),self.Merch2.fullName)

        # 价格降序排列
        MerchListPriceDesc = ws.getMerchList(sellerId=self.DealMgr.companyId,sortField="1",sortType="1",rows='999')
        self.assertEqual(MerchListPriceDesc.model['merchList'][0]['merchName'].encode('utf-8'),self.Merch2.fullName)
        self.assertEqual(MerchListPriceDesc.model['merchList'][1]['merchName'].encode('utf-8'),self.Merch1.fullName)
Ejemplo n.º 22
0
    def test_getMerchList_brand(self):
        ws = webservice()
        ws.login(self.UserShop.username, self.UserShop.password)
        # 筛选白酒品牌
        MerchList = ws.getMerchList(merchBrandId="B00003",rows='999')
        flag = False
        for i in range(0,len(MerchList.model['merchList'])):
            if MerchList.model['merchList'][i]['merchName'].encode('utf-8') == self.Merch1.fullName:
                flag = True
            if MerchList.model['merchList'][i]['merchName'].encode('utf-8') == self.Merch2.fullName:
                flag = False
                break
        self.assertEqual(flag, True, self.Merch1.fullName + ' is not found')

        # 筛选茶品牌
        MerchList = ws.getMerchList(merchBrandId=self.Merch2.brandId,rows='999')
        flag = False
        for i in range(0,len(MerchList.model['merchList'])):
            if MerchList.model['merchList'][i]['merchName'].encode('utf-8') == self.Merch2.fullName:
                flag = True
            if MerchList.model['merchList'][i]['merchName'].encode('utf-8') == self.Merch1.fullName:
                flag = False
                break
        self.assertEqual(flag, True, self.Merch2.fullName.encode('utf-8') + ' is not found')
Ejemplo n.º 23
0
 def test_modifyPwd_tokenWrong(self):
     ws = webservice()
     ws.login(self.UserShop.username, self.UserShop.password)
     modifyPwd = ws.modiyfPassword(self.UserShop.password, 'ModifyPwd', 'WrongToken')
     self.assertEqual(modifyPwd.code, 100)
Ejemplo n.º 24
0
 def test_modifyPwd_pwdSame(self):
     ws = webservice()
     ws.login(self.UserShop.username, self.UserShop.password)
     modifyPwd = ws.modiyfPassword(self.UserShop.password, self.UserShop.password)
     self.assertEqual(modifyPwd.model['success'], '0')
Ejemplo n.º 25
0
 def test_modifyPwd_pwdWrong(self):
     ws = webservice()
     ws.login(self.UserShop.username, self.UserShop.password)
     modifyPwd = ws.modiyfPassword('WorngPwd', 'ModifyPwd')
     self.assertEqual(modifyPwd.model['success'], '1')
Ejemplo n.º 26
0
 def test_getNewMerchDetail_noPrice(self):
     ws = webservice()
     ws.login(self.UserShop.username, self.UserShop.password)
     merchDetail = ws.getNewMerchDetail(merchId=self.Merch3.goodsId)
     self.assertEqual(
         merchDetail.model['newMerchDetailModel']['merchStatus'], '3')
Ejemplo n.º 27
0
 def test_getMerchDetail_NotExist(self):
     ws = webservice()
     ws.login(self.UserShop.username, self.UserShop.password)
     merchDetail = ws.getMerchDetail(merchId='NotExist')
     self.assertEqual(merchDetail.model['merchDetail']['merchStatus'], '4')
Ejemplo n.º 28
0
 def test_getMerchDetail_all(self):
     ws = webservice()
     ws.login(self.UserShop.username, self.UserShop.password)
     merchDetail = ws.getMerchDetail(merchId=self.Merch1.goodsId)
     self.assertGetMerchDetail(merchDetail, self.Merch1)
Ejemplo n.º 29
0
 def test_getMerchDetail_noSalesRight(self):
     ws = webservice()
     ws.login(self.UserShop2.username, self.UserShop2.password)
     merchDetail = ws.getMerchDetail(merchId=self.Merch2.goodsId)
     self.assertEqual(merchDetail.model['merchDetail']['merchStatus'], '3')
Ejemplo n.º 30
0
 def test_getMerchList_null(self):
     ws = webservice()
     ws.login(self.UserShop.username, self.UserShop.password)
     MerchList = ws.getMerchList(merchName="NotExist")
     self.assertEqual(MerchList.model['merchList'],[],"The merch list is not null.")