lint: test shadowing

This commit is contained in:
Umputun
2018-05-12 11:42:34 -05:00
parent 8b544b0a43
commit 5d8a3ea78b
3 changed files with 9 additions and 6 deletions
+6 -6
View File
@@ -105,13 +105,13 @@ func TestAdmin_Block(t *testing.T) {
block := func(val int) (code int, body []byte) {
client := http.Client{}
req, err := http.NewRequest(http.MethodPut,
req, e := http.NewRequest(http.MethodPut,
fmt.Sprintf("http://dev:password@127.0.0.1:%d/api/v1/admin/user/%s?site=radio-t&block=%d", port, "user1", val), nil)
assert.Nil(t, err)
resp, err := client.Do(req)
require.Nil(t, err)
body, err = ioutil.ReadAll(resp.Body)
assert.Nil(t, err)
assert.Nil(t, e)
resp, e := client.Do(req)
require.Nil(t, e)
body, e = ioutil.ReadAll(resp.Body)
assert.Nil(t, e)
resp.Body.Close()
return resp.StatusCode, body
}
+2
View File
@@ -84,6 +84,7 @@ func TestServer_Preview(t *testing.T) {
r := strings.NewReader(`{"text": "test 123", "locator":{"url": "https://radio-t.com/blah1", "site": "radio-t"}}`)
resp, err := http.Post(fmt.Sprintf("http://dev:password@127.0.0.1:%d/api/v1/preview", port), "application/json", r)
assert.Nil(t, err)
assert.Equal(t, http.StatusOK, resp.StatusCode)
b, err := ioutil.ReadAll(resp.Body)
assert.Nil(t, err)
@@ -111,6 +112,7 @@ BKT
t.Log(j)
r := strings.NewReader(j)
resp, err := http.Post(fmt.Sprintf("http://dev:password@127.0.0.1:%d/api/v1/preview", port), "application/json", r)
assert.Nil(t, err)
assert.Equal(t, http.StatusOK, resp.StatusCode)
b, err := ioutil.ReadAll(resp.Body)
assert.Nil(t, err)
+1
View File
@@ -30,6 +30,7 @@ func TestLogin(t *testing.T) {
assert.Nil(t, err)
assert.Equal(t, 200, resp.StatusCode)
body, err := ioutil.ReadAll(resp.Body)
assert.Nil(t, err)
t.Logf("resp %s", string(body))
u := store.User{}
err = json.Unmarshal(body, &u)