push_info_test.go 993 字节
package push

import (
	"github.com/gavv/httpexpect"
	"github.com/onsi/ginkgo"
	"net/http"
)

var _ = ginkgo.Describe("消息推送测试", func() {
	ginkgo.Describe("消息推送测试", func() {
		ginkgo.Context("", func() {
			ginkgo.It("", func() {
				httpExpect := httpexpect.New(ginkgo.GinkgoT(), server.URL)
				body := map[string]interface{}{
					"mmmType":     1,
					"deviceToken": "",
					"clientId":    "b5fff5f6b0af551da5f381fa47991828",
					"appkey":      "5AjJeDOSOZ5ojQpXJFjhg9",
					"secret":      "9VnM8MaA6n84Y5VnOIaSvA",
					"appId":       "TkpBI4awmg9fBUx3NWKXS6",
					"title":       " hello",
					"content":     " hello content",
					"ext":         map[string]interface{}{"transData": "trans-content"},
				}
				httpExpect.POST("/v1/push/pushInfo").
					WithJSON(body).
					Expect().
					Status(http.StatusOK).
					JSON().
					Object().
					ContainsKey("code").ValueEqual("code", 0).
					ContainsKey("msg").ValueEqual("msg", "成功")
			})
		})
	})
})