gorush/notify/notification_test.go

36 lines
659 B
Go
Raw Normal View History

package notify
import (
2017-01-19 09:08:12 +00:00
"testing"
"github.com/appleboy/gorush/config"
2022-12-03 14:44:29 +00:00
"github.com/stretchr/testify/assert"
)
func TestCorrectConf(t *testing.T) {
cfg, _ := config.LoadConf()
cfg.Android.Enabled = true
cfg.Android.APIKey = "xxxxx"
cfg.Ios.Enabled = true
cfg.Ios.KeyPath = testKeyPath
err := CheckPushConf(cfg)
assert.NoError(t, err)
}
func TestSetProxyURL(t *testing.T) {
err := SetProxy("87.236.233.92:8080")
assert.Error(t, err)
assert.Equal(t, "parse \"87.236.233.92:8080\": invalid URI for request", err.Error())
err = SetProxy("a.html")
assert.Error(t, err)
err = SetProxy("http://87.236.233.92:8080")
assert.NoError(t, err)
}