|
@@ -8,12 +8,12 @@ import (
|
8
|
8
|
"testing"
|
9
|
9
|
"time"
|
10
|
10
|
|
11
|
|
- "github.com/astaxie/beego"
|
12
|
11
|
. "github.com/smartystreets/goconvey/convey"
|
13
|
12
|
)
|
14
|
13
|
|
15
|
14
|
func TestPreGoodsOrder(t *testing.T) {
|
16
|
15
|
Convey("商品下单", t, func() {
|
|
16
|
+
|
17
|
17
|
Convey("正常下单", func() {
|
18
|
18
|
params := url.Values{}
|
19
|
19
|
params.Add("info", `{"CaseId":"1","AreaId":"12","AreaName":"吧台","TableId":"28","TableNo":"城咖啡水吧台","Amount":"23","OrdersNum":1,"Remark":"","OrgId":"1","UserName":"奥利奥","PayType":"coupon"}`)
|
|
@@ -37,11 +37,37 @@ func TestPreGoodsOrder(t *testing.T) {
|
37
|
37
|
So(code, ShouldEqual, http.StatusOK)
|
38
|
38
|
So(err, ShouldBeNil)
|
39
|
39
|
|
40
|
|
- beego.Trace(result)
|
41
|
|
-
|
42
|
40
|
// 业务返回判断
|
43
|
41
|
So(result.Code, ShouldEqual, http.StatusOK)
|
44
|
42
|
So(result.Result, ShouldNotBeEmpty)
|
45
|
43
|
})
|
46
|
44
|
})
|
47
|
45
|
}
|
|
46
|
+
|
|
47
|
+func TestConfirmOrders(t *testing.T) {
|
|
48
|
+ orderID := "cc84338e-488e-463b-a33e-7dc7f2cd10b6"
|
|
49
|
+
|
|
50
|
+ Convey("下单确认", t, func() {
|
|
51
|
+ result := &controllers.JSONMessage{}
|
|
52
|
+ api := "/api/wechat/MQ/order/goods/" + orderID
|
|
53
|
+
|
|
54
|
+ token := &utils.JWTToken{
|
|
55
|
+ Guest: false,
|
|
56
|
+ ID: "oMOpz0kgTrasoAA3G70R7phomn1g", // openid
|
|
57
|
+ Expire: time.Now().Local().Add(24 * 30 * time.Hour),
|
|
58
|
+ BatchNo: "",
|
|
59
|
+ }
|
|
60
|
+
|
|
61
|
+ code, _, err := NewRequestMock().
|
|
62
|
+ AddToken(token.ToMap()).
|
|
63
|
+ AddWechatUA().
|
|
64
|
+ Request(http.MethodPut, api, nil, result)
|
|
65
|
+
|
|
66
|
+ So(code, ShouldEqual, http.StatusOK)
|
|
67
|
+ So(err, ShouldBeNil)
|
|
68
|
+
|
|
69
|
+ // 业务返回判断
|
|
70
|
+ So(result.Code, ShouldEqual, http.StatusOK)
|
|
71
|
+ })
|
|
72
|
+
|
|
73
|
+}
|