示例#1
0
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))
}
示例#2
0
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)
}
示例#3
0
func TestFileInfo(t *testing.T) {
	LoadToken()
	_, err := FilesInfo("demo", 1)
	if err != nil {
		ex.Pect(t, fmt.Sprintf("%s", err), "file_not_found")
	}
}
示例#4
0
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))
}