def test_updateSkuImg3(self):
     '''token正确,product_id错误'''
     r = SendRequest.sendRequest(s, updateSkuImg_data[2])
     expect_result = updateSkuImg_data[2]['expect_result'].split(":",1)[1]
     msg = updateSkuImg_data[2]['msg'].split(":",1)[1]
     self.assertEqual(r.json()['execute_status'], eval(expect_result),msg=r.json())
     self.assertEqual(r.json()['data']['code'] ,eval(msg),msg=r.json())
    def test_updateSkuImg4(self):
        '''token正确,goods_sku错误'''
        r = SendRequest.sendRequest(s, updateSkuImg_data[3])
        expect_result = updateSkuImg_data[3]['expect_result'].split(":",1)[1]
        msg = updateSkuImg_data[3]['msg'].split(":",1)[1]

        self.assertEqual(r.json()['execute_status'], eval(expect_result),msg=r.json())
        self.assertEqual(r.json()['data']['errors_list'][0]['code'] ,eval(msg),msg=r.json())
Ejemplo n.º 3
0
    def test_getGroupProductId4(self):
        '''商品id错误,token正确'''
        r=SendRequest.sendRequest(s,getGroupProductId_data[3])
        expect_result=getGroupProductId_data[3]['expect_result'].split(":",1)[1]
        msg=getGroupProductId_data[3]['msg'].split(":",1)[1]

        self.assertEqual(r.json()['execute_status'],eval(expect_result),msg=r.json())
        self.assertEqual(r.json()['message'],eval(msg),msg=r.json())
Ejemplo n.º 4
0
    def test_getGroupProductId1(self):
        '''商品id正确,token正确'''
        r=SendRequest.sendRequest(s,getGroupProductId_data[0])
        expect_result=getGroupProductId_data[0]['expect_result'].split(":",1)[1]
        msg=getGroupProductId_data[0]['msg'].split(":",1)[1]

        self.assertEqual(r.json()['execute_status'],eval(expect_result),msg=r.json())
        self.assertEqual(r.json()['data'][0]['goods_id'],eval(msg),msg=r.json())
Ejemplo n.º 5
0
    def test_disableSale4(self):
        '''无海外仓直接下架:商品id错误'''
        r=SendRequest.sendRequest(s,disableSale_data[3])
        expect_result=disableSale_data[3]['expect_result'].split(":",1)[1]
        msg=disableSale_data[3]['msg'].split(":",1)[1]

        self.assertEqual(r.json()['execute_status'],eval(expect_result),msg=r.json())
        self.assertEqual(r.json()['data']['errors_list'][0]['code'], eval(msg),msg=r.json())
Ejemplo n.º 6
0
    def test_disableSale3(self):
        '''无海外仓直接下架:token和商品id都正确'''
        r=SendRequest.sendRequest(s,disableSale_data[2])
        expect_result=disableSale_data[2]['expect_result'].split(":",1)[1]
        msg=disableSale_data[2]['msg'].split(":",1)[1]

        self.assertEqual(r.json()['execute_status'],eval(expect_result),msg=r.json())
        self.assertEqual(r.json()['data']['code'],eval(msg),msg=r.json())
Ejemplo n.º 7
0
    def test_disableSale2(self):
        '''有海外仓库存:清零标准仓库存不下架'''
        r=SendRequest.sendRequest(s,disableSale_data[1])
        expect_result=disableSale_data[1]['expect_result'].split(":",1)[1]
        msg=disableSale_data[1]['msg'].split(":",1)[1]

        self.assertEqual(r.json()['execute_status'],eval(expect_result),msg=r.json())
        self.assertEqual(r.json()['data']['code'],eval(msg),msg=r.json())
    def test_updateGoodsByType6(self):
        '''参数错误'''
        r=SendRequest.sendRequest(s,updateGoodsByType_data[5])
        expect_result = updateGoodsByType_data[5]['expect_result'].split(":",1)[1]
        msg = updateGoodsByType_data[5]['msg'].split(":",1)[1]

        self.assertEqual(r.json()['execute_status'], eval(expect_result), msg=r.json())
        self.assertEqual(r.json()['message'], eval(msg), msg=r.json())
    def test_deleteGoods5(self):
        '''商品id错误,token正确'''
        r=SendRequest.sendRequest(s,deleteGoods_data[4])
        expect_result = deleteGoods_data[4]['expect_result'].split(":",1)[1]
        msg = deleteGoods_data[4]['msg'].split(":",1)[1]

        self.assertEqual(r.json()['execute_status'], eval(expect_result), msg=r.json())
        self.assertEqual(r.json()['message'], eval(msg), msg=r.json())
Ejemplo n.º 10
0
 def test_getUploadGoodsStatus3(self):
     '''token正确,批次id错误'''
     r = SendRequest.sendRequest(s, getUploadGoodsStatus_data[2])
     expect_result = getUploadGoodsStatus_data[2]['expect_result'].split(
         ":", 1)[1]
     msg = getUploadGoodsStatus_data[2]['msg'].split(":", 1)[1]
     self.assertEqual(r.json()['code'], eval(expect_result))
     self.assertEqual(r.json()['message'], eval(msg))
Ejemplo n.º 11
0
 def test_ableSale2(self):
     '''商品id错误'''
     #现接口返回错误,等开发修改
     r=SendRequest.sendRequest(s,ableSale_data[1])
     expect_result=ableSale_data[1]['expect_result'].split(":",1)[1]
     msg=ableSale_data[1]['msg'].split(":",1)[1]
     print(r.json())
     self.assertEqual(r.json()['execute_status'],eval(expect_result),msg=r.json())
     self.assertEqual(r.json()['data']['errors_list'][0]['code'], eval(msg),msg=r.json())
Ejemplo n.º 12
0
def test_shop_cart():
    # 发送请求前的准备动作
    pre_process = [
    ]
    # 收到响应后的后置操作
    post_process = [
    ]
    print(SendRequest("test_case/json_data/user/shop_cart.json").send_request(post_process=post_process,
                                                                              pre_process=pre_process).local_var)
 def test_addProductSku1(self):
     '''token及参数都正确'''
     r = SendRequest.sendRequest(s, addProductSku_data[0])
     expect_result = addProductSku_data[0]['expect_result'].split(":", 1)[1]
     msg = addProductSku_data[0]['msg'].split(":", 1)[1]
     self.assertEqual(r.json()['execute_status'],
                      eval(expect_result),
                      msg=r.json())
     self.assertEqual(r.json()['data']['message'], eval(msg), msg=r.json())
Ejemplo n.º 14
0
    def test_ableSale1(self):
        '''token和商品id都正确'''

        r=SendRequest.sendRequest(s,ableSale_data[0])
        expect_result=ableSale_data[0]['expect_result'].split(":",1)[1]
        msg=ableSale_data[0]['msg'].split(":",1)[1]

        self.assertEqual(r.json()['execute_status'],eval(expect_result),msg=r.json())
        self.assertEqual(r.json()['data']['code'],eval(msg),msg=r.json())
 def test_addProductSku2(self):
     '''新增sku参数重复'''
     r = SendRequest.sendRequest(s, addProductSku_data[0])
     expect_result = addProductSku_data[1]['expect_result'].split(":", 1)[1]
     msg = addProductSku_data[1]['msg'].split(":", 1)[1]
     self.assertEqual(r.json()['execute_status'],
                      eval(expect_result),
                      msg=r.json())
     self.assertEqual(r.json()['data']['code'], eval(msg), msg=r.json())
Ejemplo n.º 16
0
def test_new_address():
    # 发送请求前的准备动作
    pre_process = [
    ]
    # 收到响应后的后置操作
    post_process = [
    ]
    print(SendRequest("test_case/json_data/user/new_address.json").send_request(post_process=post_process,
                                                                                pre_process=pre_process).local_var)
 def test_uploadSizeChart4(self):
     '''token正确,product_id错误'''
     r = SendRequest.sendRequest(s, uploadSizeChart_data[3])
     expect_result = uploadSizeChart_data[3]['expect_result'].split(":",
                                                                    1)[1]
     msg = uploadSizeChart_data[3]['msg'].split(":", 1)[1]
     self.assertEqual(r.json()['execute_status'],
                      eval(expect_result),
                      msg=r.json())
     self.assertEqual(r.json()['message'], eval(msg), msg=r.json())
Ejemplo n.º 18
0
 def test_updateRegionShippingFee3(self):
     '''token正确,运费参数不正确'''
     r = SendRequest.sendRequest(s, updateRegionShippingFee_data[2])
     expect_result = updateRegionShippingFee_data[2]['expect_result'].split(
         ":", 1)[1]
     msg = updateRegionShippingFee_data[2]['msg'].split(":", 1)[1]
     self.assertEqual(r.json()['execute_status'],
                      eval(expect_result),
                      msg=r.json())
     self.assertEqual(r.json()['message'], eval(msg), msg=r.json())
Ejemplo n.º 19
0
def test_saveOrder():
    # 发送请求前的准备动作
    pre_process = [
    ]
    # 收到响应后的后置操作
    post_process = [
        "$JSON_EXTRACTOR(orderNo,$['data'])$"
    ]
    print(SendRequest("test_case/json_data/user/saveOrder.json").send_request(post_process=post_process,
                                                                              pre_process=pre_process).local_var)
Ejemplo n.º 20
0
 def test_getProductImgInfo3(self):
     '''商品id为空或错误'''
     r = SendRequest.sendRequest(s, getProductImgInfo_data[2])
     expect_result = getProductImgInfo_data[2]['expect_result'].split(
         ":", 1)[1]
     msg = getProductImgInfo_data[2]['msg'].split(":", 1)[1]
     self.assertEqual(r.json()['product_id'],
                      eval(expect_result),
                      msg=r.json())
     self.assertEqual(r.json()['message'], eval(msg), msg=r.json())
Ejemplo n.º 21
0
def test_address():
    # 发送请求前的准备动作
    pre_process = [
    ]
    # 收到响应后的后置操作
    post_process = [
        "$JSON_EXTRACTOR(addressId,$['data'][0]['addressId'])$"
    ]
    print(SendRequest("test_case/json_data/user/address.json").send_request(post_process=post_process,
                                                                            pre_process=pre_process).local_var)
Ejemplo n.º 22
0
    def test_getCatAttr3(self):
        '''分类id错误,token正确'''
        r = SendRequest.sendRequest(s, getCatAttr_data[2])
        expect_result = getCatAttr_data[2]['expect_result'].split(":", 1)[1]
        msg = getCatAttr_data[2]['msg'].split(":", 1)[1]

        self.assertEqual(r.json()['execute_status'],
                         eval(expect_result),
                         msg=r.json())
        self.assertEqual(r.json()['message'], eval(msg), msg=r.json())
Ejemplo n.º 23
0
def test_cart():
    # 发送请求前的准备动作
    pre_process = [
    ]
    # 收到响应后的后置操作
    post_process = [
        "$JSON_EXTRACTOR(cartItemId,$['data']['list'][0]['cartItemId'])$"
    ]
    print(SendRequest("test_case/json_data/user/cart.json").send_request(post_process=post_process,
                                                                         pre_process=pre_process).local_var)
Ejemplo n.º 24
0
def test_get_index():
    # 发送请求前的准备动作
    pre_process = [
    ]
    # 收到响应后的后置操作
    post_process = [
        "$JSON_EXTRACTOR(goodsId,$['data']['hotGoodses'][*]['goodsId'],2)$"
    ]
    print(SendRequest("test_case/json_data/user/get_index.json").send_request(post_process=post_process,
                                                                              pre_process=pre_process).local_var)
    def test_updateGoodsByType1(self):
        '''修改商品名称'''

        r=SendRequest.sendRequest(s,updateGoodsByType_data[0])
        expect_result = updateGoodsByType_data[0]['expect_result'].split(":",1)[1]
        msg = updateGoodsByType_data[0]['msg'].split(":",1)[1]
        print(r.json())
        print(updateGoodsByType_data)

        self.assertEqual(r.json()['execute_status'], eval(expect_result), msg=r.json())
        self.assertEqual(r.json()['message'], eval(msg), msg=r.json())
Ejemplo n.º 26
0
def test_register_1():
    # 发送请求前的准备动作
    pre_process = [
        {"body": {"loginName": "$PHONE()$"}}
    ]
    # 收到响应后的后置操作
    post_process = [
        '$ASSERT_CONTAINS("resultCode": 200)$',
        "$JSON_EXTRACTOR(message,$.message,0)$"
    ]
    print(SendRequest("register.json").send_request(post_process=post_process, pre_process=pre_process).local_var)
Ejemplo n.º 27
0
def test_register(file_path):  # 同一个模块中方法名不能重复
    # 发送请求前的准备动作关键字列表
    pre_process = [

    ]
    # 收到响应后的后置操作关键字列表
    post_process = [
    ]

    # 怎么复制,看下方
    SendRequest(file_path).send_request(post_process=post_process, pre_process=pre_process)
 def test_addProductSku3(self):
     '''token正确,参数为空'''
     r = SendRequest.sendRequest(s, addProductSku_data[2])
     expect_result = addProductSku_data[2]['expect_result'].split(":", 1)[1]
     msg = addProductSku_data[2]['msg'].split(
         ":", 1)[1] + ':' + addProductSku_data[2]['msg'].split(":")[2]
     self.assertEqual(r.json()['execute_status'],
                      eval(expect_result),
                      msg=r.json())
     self.assertEqual(r.json()['data']['errors_list'][0]['message'],
                      eval(msg),
                      msg=r.json())
Ejemplo n.º 29
0
def test_login():
    # 发送请求前的准备动作
    pre_process = [
        {"body": {
            "loginName": "$GET_VAR(phone)$"
        }}
    ]
    # 收到响应后的后置操作
    post_process = [
        "$JSON_EXTRACTOR(token,$.data,0)$"
    ]
    print(SendRequest("test_case/json_data/user/login.json").send_request(post_process=post_process,
                                                                          pre_process=pre_process).local_var)
Ejemplo n.º 30
0
 def test_getUploadGoodsStatus1(self):
     '''token和批次id都正确'''
     r = SendRequest.sendRequest(s, getUploadGoodsStatus_data[0])
     expect_result1 = getUploadGoodsStatus_data[0]['expect_result'].split(
         ":")[1]
     expect_result2 = getUploadGoodsStatus_data[0]['expect_result'].split(
         ":")[2]
     if r.json()['code'] == 'loading':
         self.assertEqual(r.json()['code'],
                          eval(expect_result1),
                          msg=r.json())
     else:
         self.assertEqual(r.json()['code'],
                          eval(expect_result2),
                          msg=r.json())