Quellcode durchsuchen

comments added for test case

master
Patrick Peng Sun vor 8 Jahren
Ursprung
Commit
eee25ca5f7
1 geänderte Dateien mit 4 neuen und 1 gelöschten Zeilen
  1. +4
    -1
      accessToken_test.go

+ 4
- 1
accessToken_test.go Datei anzeigen

"testing" "testing"
) )


//get accesstoken from wechat server or local cache file
func TestAccessToken(t *testing.T) { func TestAccessToken(t *testing.T) {
readConfig() readConfig()
token, err := GetAccessToken() token, err := GetAccessToken()
AssertEqual(t, token, WechatAccessToken.AccessToken, "Global accesstoken is not uptodate") AssertEqual(t, token, WechatAccessToken.AccessToken, "Global accesstoken is not uptodate")
} }


//save token to a file and read it back
func TestTokenStorage(t *testing.T) { func TestTokenStorage(t *testing.T) {
var s AuthToken var s AuthToken
s.AccessToken = "s0wf65p-KMzvYtH8qPu2qSX_EXLE2NaBgFHl7MZwedc7Kv_hdO0FG1QeUmBYJAGmQqJinPwFr67MRZwJee4rDnGVwhbuIfKs29N4ZJSXFP8fbAheuas08UuRe13UsdCtWSMcAFAGCW" s.AccessToken = "s0wf65p-KMzvYtH8qPu2qSX_EXLE2NaBgFHl7MZwedc7Kv_hdO0FG1QeUmBYJAGmQqJinPwFr67MRZwJee4rDnGVwhbuIfKs29N4ZJSXFP8fbAheuas08UuRe13UsdCtWSMcAFAGCW"
AssertEqual(t, s, token, "read token should be correct") AssertEqual(t, s, token, "read token should be correct")
} }


//read config, make sure its not empty
func TestReadConfig(t *testing.T) { func TestReadConfig(t *testing.T) {
readConfig()
SetupConfig()
if APIConfig.AppSecret == "" { if APIConfig.AppSecret == "" {
t.Error("AppSecret not available") t.Error("AppSecret not available")
} }

Laden…
Abbrechen
Speichern