Simplify code
- Removed redundant returns - Implicitly declare httptest.Server
This commit is contained in:
parent
24cdbe8c3d
commit
20bc690d8d
|
@ -16,7 +16,6 @@ func TestGetAccount(t *testing.T) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
fmt.Fprintln(w, `{"username": "zzz"}`)
|
fmt.Fprintln(w, `{"username": "zzz"}`)
|
||||||
return
|
|
||||||
}))
|
}))
|
||||||
defer ts.Close()
|
defer ts.Close()
|
||||||
|
|
||||||
|
@ -48,7 +47,6 @@ func TestGetAccountCurrentUser(t *testing.T) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
fmt.Fprintln(w, `{"username": "zzz"}`)
|
fmt.Fprintln(w, `{"username": "zzz"}`)
|
||||||
return
|
|
||||||
}))
|
}))
|
||||||
defer ts.Close()
|
defer ts.Close()
|
||||||
|
|
||||||
|
@ -80,7 +78,6 @@ func TestAccountUpdate(t *testing.T) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
fmt.Fprintln(w, `{"username": "zzz"}`)
|
fmt.Fprintln(w, `{"username": "zzz"}`)
|
||||||
return
|
|
||||||
}))
|
}))
|
||||||
defer ts.Close()
|
defer ts.Close()
|
||||||
|
|
||||||
|
|
|
@ -14,8 +14,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestCmdStream(t *testing.T) {
|
func TestCmdStream(t *testing.T) {
|
||||||
var ts *httptest.Server
|
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
ts = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
||||||
if r.URL.Path != "/api/v1/streaming/public/local" {
|
if r.URL.Path != "/api/v1/streaming/public/local" {
|
||||||
http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)
|
http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue
Block a user