remove duplicate of testing.
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
parent
9097631c92
commit
09b4bbe839
|
@ -6,8 +6,8 @@ import (
|
||||||
"github.com/google/go-gcm"
|
"github.com/google/go-gcm"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"log"
|
"log"
|
||||||
"testing"
|
|
||||||
"os"
|
"os"
|
||||||
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestDisabledAndroidIosConf(t *testing.T) {
|
func TestDisabledAndroidIosConf(t *testing.T) {
|
||||||
|
@ -228,7 +228,6 @@ func TestPushToAndroidWrongAPIKey(t *testing.T) {
|
||||||
PushConf.Android.Enabled = true
|
PushConf.Android.Enabled = true
|
||||||
PushConf.Android.ApiKey = os.Getenv("ANDROID_API_KEY") + "a"
|
PushConf.Android.ApiKey = os.Getenv("ANDROID_API_KEY") + "a"
|
||||||
|
|
||||||
|
|
||||||
req := RequestPushNotification{
|
req := RequestPushNotification{
|
||||||
Tokens: []string{"aaaaaa", "bbbbb"},
|
Tokens: []string{"aaaaaa", "bbbbb"},
|
||||||
Platform: 2,
|
Platform: 2,
|
||||||
|
@ -245,7 +244,6 @@ func TestPushToAndroidWrongToken(t *testing.T) {
|
||||||
PushConf.Android.Enabled = true
|
PushConf.Android.Enabled = true
|
||||||
PushConf.Android.ApiKey = os.Getenv("ANDROID_API_KEY")
|
PushConf.Android.ApiKey = os.Getenv("ANDROID_API_KEY")
|
||||||
|
|
||||||
|
|
||||||
req := RequestPushNotification{
|
req := RequestPushNotification{
|
||||||
Tokens: []string{"aaaaaa", "bbbbb"},
|
Tokens: []string{"aaaaaa", "bbbbb"},
|
||||||
Platform: 2,
|
Platform: 2,
|
||||||
|
|
|
@ -26,6 +26,8 @@ func TestPrintGoPushVersion(t *testing.T) {
|
||||||
func TestRunNormalServer(t *testing.T) {
|
func TestRunNormalServer(t *testing.T) {
|
||||||
initTest()
|
initTest()
|
||||||
|
|
||||||
|
gin.SetMode(gin.TestMode)
|
||||||
|
|
||||||
router := gin.New()
|
router := gin.New()
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
|
@ -199,47 +201,7 @@ func TestDisabledAndroidPushHandler(t *testing.T) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAndroidWrongAPIKey(t *testing.T) {
|
func TestAndroidPushHandler(t *testing.T) {
|
||||||
initTest()
|
|
||||||
|
|
||||||
PushConf.Android.Enabled = true
|
|
||||||
PushConf.Android.ApiKey = os.Getenv("ANDROID_API_KEY") + "a"
|
|
||||||
|
|
||||||
r := gofight.New()
|
|
||||||
|
|
||||||
r.POST("/api/push").
|
|
||||||
SetJSON(gofight.D{
|
|
||||||
"tokens": []string{"aaaaaa", "bbbbb"},
|
|
||||||
"platform": 2,
|
|
||||||
"message": "Welcome",
|
|
||||||
}).
|
|
||||||
Run(GetMainEngine(), func(r gofight.HttpResponse, rq gofight.HttpRequest) {
|
|
||||||
|
|
||||||
assert.Equal(t, http.StatusOK, r.Code)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestAndroidWrongToken(t *testing.T) {
|
|
||||||
initTest()
|
|
||||||
|
|
||||||
PushConf.Android.Enabled = true
|
|
||||||
PushConf.Android.ApiKey = os.Getenv("ANDROID_API_KEY")
|
|
||||||
|
|
||||||
r := gofight.New()
|
|
||||||
|
|
||||||
r.POST("/api/push").
|
|
||||||
SetJSON(gofight.D{
|
|
||||||
"tokens": []string{"aaaaaa", "bbbbb"},
|
|
||||||
"platform": 2,
|
|
||||||
"message": "Welcome",
|
|
||||||
}).
|
|
||||||
Run(GetMainEngine(), func(r gofight.HttpResponse, rq gofight.HttpRequest) {
|
|
||||||
|
|
||||||
assert.Equal(t, http.StatusOK, r.Code)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestAndroidRightToken(t *testing.T) {
|
|
||||||
initTest()
|
initTest()
|
||||||
|
|
||||||
PushConf.Android.Enabled = true
|
PushConf.Android.Enabled = true
|
||||||
|
|
Loading…
Reference in New Issue