func TestGenerateRequestWithValues(t *testing.T) { LoadToken() vals := url.Values{} vals.Set("testing", "test") request, _ := generateRequest("im.history", vals) ex.Pect(t, request.URL.Path, "/api/im.history") ex.Pect(t, request.URL.RawQuery, fmt.Sprintf("testing=test&token=%s", token)) }
func TestAuthTest(t *testing.T) { token = "" notok, err := AuthTest() if err != nil { t.Error(err) } ex.Pect(t, notok, false) LoadToken() ok, err := AuthTest() if err != nil { t.Error(err) } ex.Pect(t, ok, true) }
func TestFileInfo(t *testing.T) { LoadToken() _, err := FilesInfo("demo", 1) if err != nil { ex.Pect(t, fmt.Sprintf("%s", err), "file_not_found") } }
func TestGenerateRequestNoValues(t *testing.T) { LoadToken() request, _ := generateRequest("users.list", nil) ex.Pect(t, request.URL.Path, "/api/users.list") ex.Pect(t, request.URL.RawQuery, fmt.Sprintf("token=%s", token)) }