Use t.Cleanup instead of defer to close server

Signed-off-by: Vartan Benohanian <vartanbeno@gmail.com>
This commit is contained in:
Vartan Benohanian
2020-11-01 22:15:20 -05:00
parent f649927150
commit 8fe2410f4a
18 changed files with 308 additions and 612 deletions
+2 -4
View File
@@ -9,8 +9,7 @@ import (
)
func TestGoldService_Gild(t *testing.T) {
client, mux, teardown := setup()
defer teardown()
client, mux := setup(t)
mux.HandleFunc("/api/v1/gold/gild/t1_test", func(w http.ResponseWriter, r *http.Request) {
require.Equal(t, http.MethodPost, r.Method)
@@ -21,8 +20,7 @@ func TestGoldService_Gild(t *testing.T) {
}
func TestGoldService_Give(t *testing.T) {
client, mux, teardown := setup()
defer teardown()
client, mux := setup(t)
mux.HandleFunc("/api/v1/gold/give/testuser", func(w http.ResponseWriter, r *http.Request) {
require.Equal(t, http.MethodPost, r.Method)