fix: error from golangci-lint tool (#623)
This commit is contained in:
@@ -2,6 +2,7 @@ package notify
|
||||
|
||||
import (
|
||||
"log"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/appleboy/gorush/config"
|
||||
@@ -14,5 +15,5 @@ func TestMain(m *testing.M) {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
m.Run()
|
||||
os.Exit(m.Run())
|
||||
}
|
||||
|
||||
@@ -96,8 +96,8 @@ func TestIOSNotificationStructure(t *testing.T) {
|
||||
soundVolume, _ := jsonparser.GetFloat(data, "aps", "sound", "volume")
|
||||
contentAvailable, _ := jsonparser.GetInt(data, "aps", "content-available")
|
||||
category, _ := jsonparser.GetString(data, "aps", "category")
|
||||
key1 := dat["key1"].(interface{})
|
||||
key2 := dat["key2"].(interface{})
|
||||
key1 := dat["key1"]
|
||||
key2 := dat["key2"]
|
||||
aps := dat["aps"].(map[string]interface{})
|
||||
urlArgs := aps["url-args"].([]interface{})
|
||||
|
||||
@@ -732,7 +732,9 @@ func TestPushToIOS(t *testing.T) {
|
||||
}
|
||||
|
||||
// send fail
|
||||
PushToIOS(req, cfg)
|
||||
resp, err := PushToIOS(req, cfg)
|
||||
assert.Nil(t, err)
|
||||
assert.Len(t, resp.Logs, 2)
|
||||
}
|
||||
|
||||
func TestApnsHostFromRequest(t *testing.T) {
|
||||
|
||||
@@ -46,7 +46,9 @@ func TestPushToAndroidWrongToken(t *testing.T) {
|
||||
}
|
||||
|
||||
// Android Success count: 0, Failure count: 2
|
||||
PushToAndroid(req, cfg)
|
||||
resp, err := PushToAndroid(req, cfg)
|
||||
assert.Nil(t, err)
|
||||
assert.Len(t, resp.Logs, 2)
|
||||
}
|
||||
|
||||
func TestPushToAndroidRightTokenForJSONLog(t *testing.T) {
|
||||
@@ -65,7 +67,9 @@ func TestPushToAndroidRightTokenForJSONLog(t *testing.T) {
|
||||
Message: "Welcome",
|
||||
}
|
||||
|
||||
PushToAndroid(req, cfg)
|
||||
resp, err := PushToAndroid(req, cfg)
|
||||
assert.Nil(t, err)
|
||||
assert.Len(t, resp.Logs, 0)
|
||||
}
|
||||
|
||||
func TestPushToAndroidRightTokenForStringLog(t *testing.T) {
|
||||
@@ -82,7 +86,9 @@ func TestPushToAndroidRightTokenForStringLog(t *testing.T) {
|
||||
Message: "Welcome",
|
||||
}
|
||||
|
||||
PushToAndroid(req, cfg)
|
||||
resp, err := PushToAndroid(req, cfg)
|
||||
assert.Nil(t, err)
|
||||
assert.Len(t, resp.Logs, 0)
|
||||
}
|
||||
|
||||
func TestOverwriteAndroidAPIKey(t *testing.T) {
|
||||
@@ -200,7 +206,10 @@ func TestCheckAndroidMessage(t *testing.T) {
|
||||
TimeToLive: &timeToLive,
|
||||
}
|
||||
|
||||
PushToAndroid(req, cfg)
|
||||
// the message's TimeToLive field must be an integer between 0 and 2419200 (4 weeks)
|
||||
resp, err := PushToAndroid(req, cfg)
|
||||
assert.NotNil(t, err)
|
||||
assert.Nil(t, resp)
|
||||
}
|
||||
|
||||
func TestAndroidNotificationStructure(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user