mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
28 lines
839 B
Go
28 lines
839 B
Go
package twitter
|
|
|
|
import (
|
|
"fmt"
|
|
"net/http"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestAccountService_VerifyCredentials(t *testing.T) {
|
|
httpClient, mux, server := testServer()
|
|
defer server.Close()
|
|
|
|
mux.HandleFunc("/1.1/account/verify_credentials.json", func(w http.ResponseWriter, r *http.Request) {
|
|
assertMethod(t, "GET", r)
|
|
assertQuery(t, map[string]string{"include_entities": "false", "include_email": "true"}, r)
|
|
w.Header().Set("Content-Type", "application/json")
|
|
fmt.Fprintf(w, `{"name": "Dalton Hubble", "id": 623265148}`)
|
|
})
|
|
|
|
client := NewClient(httpClient)
|
|
user, _, err := client.Accounts.VerifyCredentials(&AccountVerifyParams{IncludeEntities: Bool(false), IncludeEmail: Bool(true)})
|
|
expected := &User{Name: "Dalton Hubble", ID: 623265148}
|
|
assert.Nil(t, err)
|
|
assert.Equal(t, expected, user)
|
|
}
|