Merge pull request #32 from y0za/fix-test-json

Fix test json property name
This commit is contained in:
mattn 2017-04-20 19:59:41 +09:00 committed by GitHub
commit c417db5189
5 changed files with 31 additions and 31 deletions

View File

@ -14,7 +14,7 @@ func TestGetAccount(t *testing.T) {
http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound) http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)
return return
} }
fmt.Fprintln(w, `{"Username": "zzz"}`) fmt.Fprintln(w, `{"username": "zzz"}`)
return return
})) }))
defer ts.Close() defer ts.Close()
@ -46,7 +46,7 @@ func TestGetAccountCurrentUser(t *testing.T) {
http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError) http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
return return
} }
fmt.Fprintln(w, `{"Username": "zzz"}`) fmt.Fprintln(w, `{"username": "zzz"}`)
return return
})) }))
defer ts.Close() defer ts.Close()
@ -78,7 +78,7 @@ func TestAccountUpdate(t *testing.T) {
http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError) http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
return return
} }
fmt.Fprintln(w, `{"Username": "zzz"}`) fmt.Fprintln(w, `{"username": "zzz"}`)
return return
})) }))
defer ts.Close() defer ts.Close()
@ -113,7 +113,7 @@ func TestGetAccountStatuses(t *testing.T) {
http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound) http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)
return return
} }
fmt.Fprintln(w, `[{"Content": "foo"}, {"Content": "bar"}]`) fmt.Fprintln(w, `[{"content": "foo"}, {"content": "bar"}]`)
return return
})) }))
defer ts.Close() defer ts.Close()
@ -146,7 +146,7 @@ func TestGetAccountFollowers(t *testing.T) {
http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound) http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)
return return
} }
fmt.Fprintln(w, `[{"Username": "foo"}, {"Username": "bar"}]`) fmt.Fprintln(w, `[{"username": "foo"}, {"username": "bar"}]`)
return return
})) }))
defer ts.Close() defer ts.Close()
@ -182,7 +182,7 @@ func TestGetAccountFollowing(t *testing.T) {
http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound) http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)
return return
} }
fmt.Fprintln(w, `[{"Username": "foo"}, {"Username": "bar"}]`) fmt.Fprintln(w, `[{"username": "foo"}, {"username": "bar"}]`)
return return
})) }))
defer ts.Close() defer ts.Close()
@ -220,7 +220,7 @@ func TestGetBlocks(t *testing.T) {
http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError) http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
return return
} }
fmt.Fprintln(w, `[{"Username": "foo"}, {"Username": "bar"}]`) fmt.Fprintln(w, `[{"username": "foo"}, {"username": "bar"}]`)
return return
})) }))
defer ts.Close() defer ts.Close()
@ -487,7 +487,7 @@ func TestAccountsSearch(t *testing.T) {
http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError) http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
return return
} }
fmt.Fprintln(w, `[{"Username": "foobar"}, {"Username": "barfoo"}]`) fmt.Fprintln(w, `[{"username": "foobar"}, {"username": "barfoo"}]`)
return return
})) }))
defer ts.Close() defer ts.Close()
@ -523,7 +523,7 @@ func TestFollowRemoteUser(t *testing.T) {
http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError) http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
return return
} }
fmt.Fprintln(w, `{"Username": "zzz"}`) fmt.Fprintln(w, `{"username": "zzz"}`)
return return
})) }))
defer ts.Close() defer ts.Close()
@ -555,7 +555,7 @@ func TestGetFollowRequests(t *testing.T) {
http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError) http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
return return
} }
fmt.Fprintln(w, `[{"Username": "foo"}, {"Username": "bar"}]`) fmt.Fprintln(w, `[{"username": "foo"}, {"username": "bar"}]`)
return return
})) }))
defer ts.Close() defer ts.Close()
@ -641,7 +641,7 @@ func TestGetMutes(t *testing.T) {
http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError) http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
return return
} }
fmt.Fprintln(w, `[{"Username": "foo"}, {"Username": "bar"}]`) fmt.Fprintln(w, `[{"username": "foo"}, {"username": "bar"}]`)
return return
})) }))
defer ts.Close() defer ts.Close()

View File

@ -14,7 +14,7 @@ func TestCmdUpload(t *testing.T) {
func(w http.ResponseWriter, r *http.Request) { func(w http.ResponseWriter, r *http.Request) {
switch r.URL.Path { switch r.URL.Path {
case "/api/v1/media": case "/api/v1/media":
fmt.Fprintln(w, `{"ID": 123}`) fmt.Fprintln(w, `{"id": 123}`)
return return
} }
http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound) http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)

View File

@ -17,7 +17,7 @@ func TestAuthenticate(t *testing.T) {
http.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest) http.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest)
return return
} }
fmt.Fprintln(w, `{"AccessToken": "zoo"}`) fmt.Fprintln(w, `{"access_token": "zoo"}`)
return return
})) }))
defer ts.Close() defer ts.Close()
@ -72,7 +72,7 @@ func TestPostStatus(t *testing.T) {
http.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest) http.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest)
return return
} }
fmt.Fprintln(w, `{"AccessToken": "zoo"}`) fmt.Fprintln(w, `{"access_token": "zoo"}`)
return return
})) }))
defer ts.Close() defer ts.Close()
@ -130,7 +130,7 @@ func TestPostStatusWithCancel(t *testing.T) {
func TestGetTimelineHome(t *testing.T) { func TestGetTimelineHome(t *testing.T) {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintln(w, `[{"Content": "foo"}, {"Content": "bar"}]`) fmt.Fprintln(w, `[{"content": "foo"}, {"content": "bar"}]`)
return return
})) }))
defer ts.Close() defer ts.Close()

View File

@ -10,7 +10,7 @@ import (
func TestGetFavourites(t *testing.T) { func TestGetFavourites(t *testing.T) {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintln(w, `[{"Content": "foo"}, {"Content": "bar"}]`) fmt.Fprintln(w, `[{"content": "foo"}, {"content": "bar"}]`)
return return
})) }))
defer ts.Close() defer ts.Close()
@ -42,7 +42,7 @@ func TestGetStatus(t *testing.T) {
http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound) http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)
return return
} }
fmt.Fprintln(w, `{"Content": "zzz"}`) fmt.Fprintln(w, `{"content": "zzz"}`)
return return
})) }))
defer ts.Close() defer ts.Close()
@ -72,7 +72,7 @@ func TestGetStatusCard(t *testing.T) {
http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound) http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)
return return
} }
fmt.Fprintln(w, `{"Title": "zzz"}`) fmt.Fprintln(w, `{"title": "zzz"}`)
return return
})) }))
defer ts.Close() defer ts.Close()
@ -102,7 +102,7 @@ func TestGetStatusContext(t *testing.T) {
http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound) http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)
return return
} }
fmt.Fprintln(w, `{"ancestors": [{"Content": "zzz"},{"Content": "bbb"}]}`) fmt.Fprintln(w, `{"ancestors": [{"content": "zzz"},{"content": "bbb"}]}`)
return return
})) }))
defer ts.Close() defer ts.Close()
@ -141,7 +141,7 @@ func TestGetRebloggedBy(t *testing.T) {
http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound) http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)
return return
} }
fmt.Fprintln(w, `[{"Username": "foo"}, {"Username": "bar"}]`) fmt.Fprintln(w, `[{"username": "foo"}, {"username": "bar"}]`)
return return
})) }))
defer ts.Close() defer ts.Close()
@ -177,7 +177,7 @@ func TestGetFavouritedBy(t *testing.T) {
http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound) http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)
return return
} }
fmt.Fprintln(w, `[{"Username": "foo"}, {"Username": "bar"}]`) fmt.Fprintln(w, `[{"username": "foo"}, {"username": "bar"}]`)
return return
})) }))
defer ts.Close() defer ts.Close()
@ -213,7 +213,7 @@ func TestReblog(t *testing.T) {
http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound) http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)
return return
} }
fmt.Fprintln(w, `{"Content": "zzz"}`) fmt.Fprintln(w, `{"content": "zzz"}`)
return return
})) }))
defer ts.Close() defer ts.Close()
@ -243,7 +243,7 @@ func TestUnreblog(t *testing.T) {
http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound) http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)
return return
} }
fmt.Fprintln(w, `{"Content": "zzz"}`) fmt.Fprintln(w, `{"content": "zzz"}`)
return return
})) }))
defer ts.Close() defer ts.Close()
@ -273,7 +273,7 @@ func TestFavourite(t *testing.T) {
http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound) http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)
return return
} }
fmt.Fprintln(w, `{"Content": "zzz"}`) fmt.Fprintln(w, `{"content": "zzz"}`)
return return
})) }))
defer ts.Close() defer ts.Close()
@ -303,7 +303,7 @@ func TestUnfavourite(t *testing.T) {
http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound) http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)
return return
} }
fmt.Fprintln(w, `{"Content": "zzz"}`) fmt.Fprintln(w, `{"content": "zzz"}`)
return return
})) }))
defer ts.Close() defer ts.Close()
@ -333,7 +333,7 @@ func TestGetTimelineHashtag(t *testing.T) {
http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound) http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)
return return
} }
fmt.Fprintln(w, `[{"Content": "zzz"},{"Content": "yyy"}]`) fmt.Fprintln(w, `[{"content": "zzz"},{"content": "yyy"}]`)
return return
})) }))
defer ts.Close() defer ts.Close()
@ -405,8 +405,8 @@ func TestSearch(t *testing.T) {
} }
fmt.Fprintln(w, ` fmt.Fprintln(w, `
{"accounts":[{"Username": "zzz"},{"Username": "yyy"}], {"accounts":[{"username": "zzz"},{"username": "yyy"}],
"statuses":[{"Content": "aaa"}], "statuses":[{"content": "aaa"}],
"hashtags":["tag","tag2","tag3"] "hashtags":["tag","tag2","tag3"]
}`) }`)
return return
@ -453,7 +453,7 @@ func TestUploadMedia(t *testing.T) {
http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound) http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)
return return
} }
fmt.Fprintln(w, `{"ID": 123}`) fmt.Fprintln(w, `{"id": 123}`)
return return
})) }))
defer ts.Close() defer ts.Close()

View File

@ -18,13 +18,13 @@ func TestStreamingPublic(t *testing.T) {
f, _ := w.(http.Flusher) f, _ := w.(http.Flusher)
fmt.Fprintln(w, ` fmt.Fprintln(w, `
event: update event: update
data: {"Content": "foo"} data: {"content": "foo"}
`) `)
f.Flush() f.Flush()
fmt.Fprintln(w, ` fmt.Fprintln(w, `
event: update event: update
data: {"Content": "bar"} data: {"content": "bar"}
`) `)
f.Flush() f.Flush()
return return