...
|
...
|
@@ -3,6 +3,7 @@ package getuiV2 |
|
|
import (
|
|
|
"openapi/pkg/infrastructure/push"
|
|
|
"openapi/pkg/infrastructure/utils"
|
|
|
"sync"
|
|
|
"testing"
|
|
|
)
|
|
|
|
...
|
...
|
@@ -77,3 +78,29 @@ func TestGetuiPrd(t *testing.T) { |
|
|
t.Fatal(err)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
func TestGetAuthToken(t *testing.T) {
|
|
|
var wg sync.WaitGroup
|
|
|
round := 100
|
|
|
notification := &GetuiNotification{}
|
|
|
var tokenMap = make(map[string]string)
|
|
|
notification.Init(
|
|
|
push.DebugModule(true),
|
|
|
|
|
|
push.AppId("WgrbaaStTk7JElrXOCgUg6"),
|
|
|
push.AppKey("FG5lbqVrHa5rS9NVfxNP7"),
|
|
|
push.AppMasterSecret("FW3jMNLJrRARYKv2iqA5H5"),
|
|
|
)
|
|
|
for i := 0; i < round; i++ {
|
|
|
wg.Add(1)
|
|
|
go func() {
|
|
|
defer wg.Done()
|
|
|
token, _ := notification.GetAuthToken()
|
|
|
tokenMap[token] = token
|
|
|
}()
|
|
|
}
|
|
|
wg.Wait()
|
|
|
if len(tokenMap) > 1 {
|
|
|
t.Fatalf("token want 1 get %v", len(tokenMap))
|
|
|
}
|
|
|
} |
...
|
...
|
|