Procházet zdrojové kódy

comments added for test case

master
Patrick Peng Sun před 8 roky
rodič
revize
eee25ca5f7
1 změnil soubory, kde provedl 4 přidání a 1 odebrání
  1. +4
    -1
      accessToken_test.go

+ 4
- 1
accessToken_test.go Zobrazit soubor

"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")
} }

Načítá se…
Zrušit
Uložit