Skip to content

Commit 6efc40b

Browse files
committed
fix test
1 parent 67f72d1 commit 6efc40b

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

status_test.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -995,15 +995,19 @@ func TestSearch(t *testing.T) {
995995

996996
func TestUploadMedia(t *testing.T) {
997997
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
998-
if r.URL.Path != "/api/v1/media" {
998+
if r.Method != "POST" {
999999
http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)
10001000
return
10011001
}
1002-
if r.Method != "POST" {
1003-
http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)
1002+
if r.URL.Path == "/api/v1/media" {
1003+
fmt.Fprintln(w, `{"id": 123}`)
1004+
return
1005+
}
1006+
if r.URL.Path == "/api/v2/media" {
1007+
fmt.Fprintln(w, `{"id": 123}`)
10041008
return
10051009
}
1006-
fmt.Fprintln(w, `{"id": 123}`)
1010+
http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)
10071011
}))
10081012
defer ts.Close()
10091013

0 commit comments

Comments
 (0)