diff --git a/accessToken_test.go b/accessToken_test.go index 7469f43..8fda2a7 100644 --- a/accessToken_test.go +++ b/accessToken_test.go @@ -7,6 +7,7 @@ import ( "testing" ) +//get accesstoken from wechat server or local cache file func TestAccessToken(t *testing.T) { readConfig() token, err := GetAccessToken() @@ -17,6 +18,7 @@ func TestAccessToken(t *testing.T) { AssertEqual(t, token, WechatAccessToken.AccessToken, "Global accesstoken is not uptodate") } +//save token to a file and read it back func TestTokenStorage(t *testing.T) { var s AuthToken s.AccessToken = "s0wf65p-KMzvYtH8qPu2qSX_EXLE2NaBgFHl7MZwedc7Kv_hdO0FG1QeUmBYJAGmQqJinPwFr67MRZwJee4rDnGVwhbuIfKs29N4ZJSXFP8fbAheuas08UuRe13UsdCtWSMcAFAGCW" @@ -29,8 +31,9 @@ func TestTokenStorage(t *testing.T) { AssertEqual(t, s, token, "read token should be correct") } +//read config, make sure its not empty func TestReadConfig(t *testing.T) { - readConfig() + SetupConfig() if APIConfig.AppSecret == "" { t.Error("AppSecret not available") }