- add many TestCallbackMsgPlayback.

This commit is contained in:
gazebo
2018-06-29 10:41:18 +08:00
parent 8c4e92f5ef
commit 6b865b5f4c
4 changed files with 130 additions and 0 deletions

View File

@@ -70,3 +70,49 @@ func TestRefreshTokenIndividual(t *testing.T) {
}
sugarLogger.Debug(result)
}
func TestCallbackMsgPlayback(t *testing.T) {
playbackData := [][]string{
[]string{
"{\"requestId\":\"200016744375484334\",\"type\":10,\"appId\":78247922,\"message\":\"{\\\"id\\\":\\\"3025365125607913707\\\",\\\"orderId\\\":\\\"3025365125607913707\\\",\\\"address\\\":\\\"新世纪百货(民心佳园店)民心家园45栋22-3 民心佳园45栋22-3\\\",\\\"createdAt\\\":\\\"2018-06-28T14:25:53\\\",\\\"activeAt\\\":\\\"2018-06-28T14:25:53\\\",\\\"deliverFee\\\":1.0,\\\"deliverTime\\\":null,\\\"description\\\":\\\"猪脚砍成小块 一定要砍 谢谢\\\",\\\"groups\\\":[{\\\"name\\\":\\\"1号篮子\\\",\\\"type\\\":\\\"normal\\\",\\\"items\\\":[{\\\"id\\\":1419971532,\\\"skuId\\\":200000225250841518,\\\"name\\\":\\\"前脚约450g/份\\\",\\\"categoryId\\\":1,\\\"price\\\":32.0,\\\"quantity\\\":1,\\\"total\\\":32.0,\\\"additions\\\":[],\\\"newSpecs\\\":[],\\\"attributes\\\":[],\\\"extendCode\\\":\\\"\\\",\\\"barCode\\\":\\\"1631\\\",\\\"weight\\\":450.0,\\\"userPrice\\\":0.0,\\\"shopPrice\\\":0.0,\\\"vfoodId\\\":1392153708},{\\\"id\\\":1419974600,\\\"skuId\\\":200000225254000558,\\\"name\\\":\\\"红花生米约500g/份\\\",\\\"categoryId\\\":1,\\\"price\\\":11.43,\\\"quantity\\\":1,\\\"total\\\":11.43,\\\"additions\\\":[],\\\"newSpecs\\\":[],\\\"attributes\\\":[],\\\"extendCode\\\":\\\"\\\",\\\"barCode\\\":\\\"654\\\",\\\"weight\\\":500.0,\\\"userPrice\\\":0.0,\\\"shopPrice\\\":0.0,\\\"vfoodId\\\":1392165882},{\\\"id\\\":1419958462,\\\"skuId\\\":200000225237475246,\\\"name\\\":\\\"莲藕约500g/份\\\",\\\"categoryId\\\":1,\\\"price\\\":8.0,\\\"quantity\\\":1,\\\"total\\\":8.0,\\\"additions\\\":[],\\\"newSpecs\\\":[],\\\"attributes\\\":[],\\\"extendCode\\\":\\\"\\\",\\\"barCode\\\":\\\"3171\\\",\\\"weight\\\":500.0,\\\"userPrice\\\":0.0,\\\"shopPrice\\\":0.0,\\\"vfoodId\\\":1392164749}]}],\\\"invoice\\\":null,\\\"book\\\":false,\\\"onlinePaid\\\":true,\\\"railwayAddress\\\":null,\\\"phoneList\\\":[\\\"18983425091\\\"],\\\"shopId\\\":157465482,\\\"shopName\\\":\\\"好菜鲜生(民心店)\\\",\\\"daySn\\\":3,\\\"status\\\":\\\"unprocessed\\\",\\\"refundStatus\\\":\\\"noRefund\\\",\\\"userId\\\":82003158,\\\"userIdStr\\\":\\\"82003158\\\",\\\"totalPrice\\\":37.43,\\\"originalPrice\\\":52.43,\\\"consignee\\\":\\\"代**\\\",\\\"deliveryGeo\\\":\\\"106.56272398,29.62484594\\\",\\\"deliveryPoiAddress\\\":\\\"新世纪百货(民心佳园店)民心家园45栋22-3 民心佳园45栋22-3\\\",\\\"invoiced\\\":false,\\\"income\\\":35.56,\\\"serviceRate\\\":0.05,\\\"serviceFee\\\":-1.87,\\\"hongbao\\\":0.0,\\\"packageFee\\\":0.0,\\\"activityTotal\\\":-15.0,\\\"shopPart\\\":-15.0,\\\"elemePart\\\":-0.0,\\\"downgraded\\\":false,\\\"vipDeliveryFeeDiscount\\\":0.0,\\\"openId\\\":\\\"\\\",\\\"secretPhoneExpireTime\\\":null,\\\"orderActivities\\\":[{\\\"categoryId\\\":12,\\\"name\\\":\\\"在线支付立减优惠\\\",\\\"amount\\\":-15.0,\\\"elemePart\\\":0.0,\\\"restaurantPart\\\":-15.0,\\\"familyPart\\\":0.0,\\\"id\\\":1236491610,\\\"orderAllPartiesPartList\\\":[{\\\"partName\\\":\\\"商家补贴\\\",\\\"partAmount\\\":\\\"15.0\\\"}]}],\\\"invoiceType\\\":null,\\\"taxpayerId\\\":\\\"\\\",\\\"coldBoxFee\\\":0.0,\\\"cancelOrderDescription\\\":null,\\\"cancelOrderCreatedAt\\\":null,\\\"orderCommissions\\\":[]}\",\"shopId\":157465482,\"timestamp\":1530167153482,\"signature\":\"9A1D366FE631A54390A20A2E023B41A8\",\"userId\":336072266326420104}",
"http://callback.test.jxc4.com:8080/eleme/msg",
"application/json; charset=utf-8",
},
[]string{
"{\"requestId\":\"200016744381715374\",\"type\":12,\"appId\":78247922,\"message\":\"{\\\"orderId\\\":\\\"3025365125607913707\\\",\\\"state\\\":\\\"valid\\\",\\\"shopId\\\":157465482,\\\"updateTime\\\":1530167232,\\\"role\\\":3}\",\"shopId\":157465482,\"timestamp\":1530167232500,\"signature\":\"4B491256CC0015603F12CACAE9AFA004\",\"userId\":336072266326420104}",
"http://callback.test.jxc4.com:8080/eleme/msg",
"application/json; charset=utf-8",
},
[]string{
"sign=d75dc693f00ced3ace82c46a46a57e0e61034f14&timestamp=1530168075&delivery_id=423296&status=0&appkey=3c0a05d464c247c19d7ec13accc78605&order_id=3025365125607913707&mt_peisong_id=1530168075083323",
"http://callback.test.jxc4.com:8080/mtps/status",
"",
},
[]string{
"sign=f539529a0c1db827135f5ff576d581016ef9f8ef&timestamp=1530168134&delivery_id=423296&status=20&appkey=3c0a05d464c247c19d7ec13accc78605&courier_phone=17783604157&courier_name=%E7%99%BD%E5%B7%9D%E8%8B%B1&order_id=3025365125607913707&mt_peisong_id=1530168075083323",
"http://callback.test.jxc4.com:8080/mtps/status",
"",
},
[]string{
"sign=552cd6f662e7117d9975d55a86313bdf7cdce964&timestamp=1530169704&delivery_id=423296&status=30&appkey=3c0a05d464c247c19d7ec13accc78605&courier_phone=17783604157&courier_name=%E7%99%BD%E5%B7%9D%E8%8B%B1&order_id=3025365125607913707&mt_peisong_id=1530168075083323",
"http://callback.test.jxc4.com:8080/mtps/status",
"",
},
[]string{
"sign=eec01e70060faa86a81d9e5ee520db69594504e0&timestamp=1530169998&delivery_id=423296&status=50&appkey=3c0a05d464c247c19d7ec13accc78605&courier_phone=17783604157&courier_name=%E7%99%BD%E5%B7%9D%E8%8B%B1&order_id=3025365125607913707&mt_peisong_id=1530168075083323",
"http://callback.test.jxc4.com:8080/mtps/status",
"",
},
[]string{
"{\"requestId\":\"200016744576047022\",\"type\":18,\"appId\":78247922,\"message\":\"{\\\"orderId\\\":\\\"3025365125607913707\\\",\\\"state\\\":\\\"settled\\\",\\\"shopId\\\":157465482,\\\"updateTime\\\":1530169999,\\\"role\\\":3}\",\"shopId\":157465482,\"timestamp\":1530169999773,\"signature\":\"7D0DCE6C3514B16DA97171E5CDFABE0F\",\"userId\":336072266326420104}",
"http://callback.test.jxc4.com:8080/eleme/msg",
"application/json; charset=utf-8",
},
}
for _, v := range playbackData {
_, err := utils.SendFakeRequest("POST", v[1], v[0], v[2])
if err != nil {
t.Fatal(err)
}
}
}