parent
3268207afe
commit
559ed99cdf
5 changed files with 125 additions and 3 deletions
|
@ -370,6 +370,28 @@ func TestGetTimelinePublic(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestGetTimelineDirect(t *testing.T) {
|
||||
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
fmt.Fprintln(w, `[{"content": "direct"}, {"content": "status"}]`)
|
||||
}))
|
||||
defer ts.Close()
|
||||
|
||||
client := NewClient(&Config{Server: ts.URL})
|
||||
tl, err := client.GetTimelineDirect(context.Background(), nil)
|
||||
if err != nil {
|
||||
t.Fatalf("should not be fail: %v", err)
|
||||
}
|
||||
if len(tl) != 2 {
|
||||
t.Fatalf("result should be two: %d", len(tl))
|
||||
}
|
||||
if tl[0].Content != "direct" {
|
||||
t.Fatalf("want %q but %q", "foo", tl[0].Content)
|
||||
}
|
||||
if tl[1].Content != "status" {
|
||||
t.Fatalf("want %q but %q", "bar", tl[1].Content)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetTimelineHashtag(t *testing.T) {
|
||||
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
if r.URL.Path != "/api/v1/timelines/tag/zzz" {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue