예제 #1
0
    def test_scene4(self):
        # 查询收货地址
        address_list_result = SendHttp().sent_get_bycookies(self.Address_list_url, Common.getcookies(self.user))
        province = address_list_result['result']['list'][0]['province']
        city = address_list_result['result']['list'][0]['city']
        area = address_list_result['result']['list'][0]['area']
        receiverName = address_list_result['result']['list'][0]['receiverName']
        cellPhone = address_list_result['result']['list'][0]['cellPhone']
        addressDetail = address_list_result['result']['list'][0]['addressDetail']
        print(address_list_result)

        # 计算运费
        address = {"addressDetail": "province+'_'+city+'_'+area", "id": "1", "tm": "1542069300054"}
        getFee_result = SendHttp().sent_get_bycookies(self.getFee_url, Common.getcookies(self.user), address)
        print(getFee_result)
        transportFee = getFee_result['result']
        print(transportFee)

        # 提交订单
        param = {"skuIds": "2,3", "skuNumbers": "1,1", "stockIds": "74966312,74966313",
                 "receiverName": receiverName, "cellPhone": cellPhone, "addressDetail": addressDetail,
                 "province": province, "city": city, "area": area,
                 "transportFee": transportFee, "logisticsCompanyId": 1, }
        submit_result = SendHttp().send_post_bycookie(self.submit_url, Common.getcookies(self.user), param)
        print(submit_result)

        self.assertEqual(200, submit_result['code'])
        print('以上为场景四')
예제 #2
0
    def test_scene3(self):
        # 查询收货地址
        address_list_result = SendHttp().sent_get_bycookies(self.Address_list_url, Common.getcookies(self.user))
        print(address_list_result)
        self.assertEqual(200, address_list_result['code'])

        # 添加收货地址
        paramdata = {"id": "",
                     "receiverName": "杨天莹2",
                     "cellPhone": "12222222222",
                     "province": "北京市", "city": "朝阳区",
                     "area": "",
                     "addressDetail": "某某小区"
                     }
        Add_address_result = SendHttp().send_post_bycookie(self.Add_address_url, Common.getcookies(self.user),
                                                           paramdata)
        print(Add_address_result)
        self.assertEqual(200, Add_address_result['code'])

        address_list_result = SendHttp().sent_get_bycookies(self.Address_list_url, Common.getcookies(self.user))

        province = address_list_result['result']['list'][0]['province']
        city = address_list_result['result']['list'][0]['city']
        area = address_list_result['result']['list'][0]['area']
        receiverName = address_list_result['result']['list'][0]['receiverName']
        cellPhone = address_list_result['result']['list'][0]['cellPhone']
        addressDetail = address_list_result['result']['list'][0]['addressDetail']

        # 计算运费
        address = {"addressDetail": "province+'_'+city+'_'+area", "id": "1", "tm": "1545210105957"}
        getFee_result = SendHttp().sent_get_bycookies(self.getFee_url, Common.getcookies(self.user), address)
        transportFee = getFee_result['result']
        print(transportFee)

        # 提交订单
        param = {"skuIds": 3,
                 "skuNumbers": 2,
                 "stockIds": 74966313,
                 "receiverName": receiverName,
                 "cellPhone": cellPhone,
                 "addressDetail": addressDetail,
                 "province": province,
                 "city": city,
                 "area": area,
                 "voiceStatus": 0,
                 "needInvoice": 0,
                 "invoiceHead": "",
                 "transportFee": 0,
                 "logisticsCompanyId": 1,
                 "accessSource": "noSource",
                 "accessDevice": 0}

        submit_result = SendHttp().send_post_bycookie(self.submit_url, Common.getcookies(self.user), param)
        print(submit_result)
        print('以上为场景三')
예제 #3
0
 def user_login(self):
     user = {
         "password": "******",
         "phoneArea": "86",
         "phoneNumber": "2000000000121"
     }
     return Common.getcookies(user)
예제 #4
0
 def test_submit2(self):
     user = {
         "phoneArea": "86",
         "phoneNumber": "20000000001",
         "password": "******"
     }
     data = {
         "skuIds": "2,3",
         "skuNumbers": 11,
         "stockIds": "74966312,74966313",
         "receiverName": "张三",
         "cellPhone": "12615813537",
         "addressDetail": "1 栋 3 单元",
         "province": "浙江省",
         "city": "杭州市",
         "area": "滨江区",
         "voiceStatus": 0,
         "needInvoice": 0,
         "invoiceHead": "",
         "transportFee": 0,
         "logisticsCompanyId": 1,
         "accessSource": "noSource",
         "accessDevice": 0
     }
     # result = SendHttp().send_post_bycookies(self.url, Common.getcookies(user), data)
     result = SendHttp().send_post_bycookie(self.url,
                                            Common.getcookies(user), data)
     print(result)
     self.assertEqual(result['code'], 200)
 def test_address_by_Login_success(self):
     user = {
         "phoneArea": "86",
         "phoneNumber": "20000000000",
         "password": "******"
     }
     result = SendHttp().sent_get_bycookies(self.url,
                                            Common.getcookies(user))
     print(result)
     self.assertEqual(result['code'], 200)