unipush
This commit is contained in:
43
platformapi/unipushapi/unipushapi_test.go
Normal file
43
platformapi/unipushapi/unipushapi_test.go
Normal file
@@ -0,0 +1,43 @@
|
||||
package unipushapi
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"git.rosy.net.cn/baseapi"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
var (
|
||||
api *API
|
||||
sugarLogger *zap.SugaredLogger
|
||||
)
|
||||
|
||||
func init() {
|
||||
logger, _ := zap.NewDevelopment()
|
||||
sugarLogger = logger.Sugar()
|
||||
baseapi.Init(sugarLogger)
|
||||
api = New("5lyyrvHODG6wC8Sdr3a9h", "iFrkUDmR2g5eqQpfh2kQ57", "WTn53qd6WAAdLMXfmXvzb7", "dGZcR0XGGg7H5Pd7FR3n47")
|
||||
api.CBSetToken("d6b5f133d8dbc7f2890bc500dee848f1ac191a32f2d2fba39b0dcb2e52aa4265")
|
||||
// ef364b677911fa64d41a25d22d5e155065c4898046be65ddd627fa6c8cd87c2e
|
||||
}
|
||||
|
||||
func TestCBRetrieveToken(t *testing.T) {
|
||||
result, err := api.CBRetrieveToken()
|
||||
if err != nil {
|
||||
t.Fatal(err.Error())
|
||||
}
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
}
|
||||
|
||||
func TestPushToSingle(t *testing.T) {
|
||||
result, err := api.PushToSingle("4fde99c9bd3d2ab317023f429f9ef62b", true, &Notification{
|
||||
Title: "测试",
|
||||
Body: "测测测",
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal(err.Error())
|
||||
}
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
// RASS_0911_1517001ff419d4699a0be17ac3f04a54
|
||||
}
|
||||
Reference in New Issue
Block a user