lint: minor warns on tests
This commit is contained in:
@@ -231,7 +231,7 @@ Add this snippet to the bottom of web page:
|
||||
|
||||
(function() {
|
||||
var d = document, s = d.createElement('script');
|
||||
s.src = '/web/embed.js'; // prepend this address with domain where remark42 is placed
|
||||
s.src = '/web/embed.js'; // prepends this address with domain where remark42 is placed
|
||||
(d.head || d.body).appendChild(s);
|
||||
})();
|
||||
</script>
|
||||
@@ -259,7 +259,7 @@ Add this snippet to the bottom of web page:
|
||||
|
||||
(function() {
|
||||
var d = document, s = d.createElement('script');
|
||||
s.src = '/web/last-comments.js'; // prepend this address with domain where remark42 is placed
|
||||
s.src = '/web/last-comments.js'; // prepends this address with domain where remark42 is placed
|
||||
(d.head || d.body).appendChild(s);
|
||||
})();
|
||||
</script>
|
||||
@@ -287,7 +287,7 @@ Add this snippet to the bottom of web page:
|
||||
|
||||
(function() {
|
||||
var d = document, s = d.createElement('script');
|
||||
s.src = '/web/counter.js'; // prepend this address with domain where remark42 is placed
|
||||
s.src = '/web/counter.js'; // prepends this address with domain where remark42 is placed
|
||||
(d.head || d.body).appendChild(s);
|
||||
})();
|
||||
</script>
|
||||
|
||||
+4
-2
@@ -84,7 +84,8 @@ func TestApplicationFailed(t *testing.T) {
|
||||
func TestApplicationShutdown(t *testing.T) {
|
||||
app, ctx := prepApp(t, 18090, 500*time.Millisecond)
|
||||
st := time.Now()
|
||||
app.Run(ctx)
|
||||
err := app.Run(ctx)
|
||||
assert.Nil(t, err)
|
||||
assert.True(t, time.Since(st).Seconds() < 1, "should take about 500msec")
|
||||
app.Wait()
|
||||
}
|
||||
@@ -95,7 +96,8 @@ func TestApplicationMainSignal(t *testing.T) {
|
||||
|
||||
go func() {
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
syscall.Kill(syscall.Getpid(), syscall.SIGTERM)
|
||||
err := syscall.Kill(syscall.Getpid(), syscall.SIGTERM)
|
||||
require.Nil(t, err)
|
||||
}()
|
||||
st := time.Now()
|
||||
main()
|
||||
|
||||
@@ -76,6 +76,6 @@ func TestBackup_Do(t *testing.T) {
|
||||
type mockExporter struct{}
|
||||
|
||||
func (mock *mockExporter) Export(w io.Writer, siteID string) (int, error) {
|
||||
w.Write([]byte("some export blah blah 1234567890"))
|
||||
return 1000, nil
|
||||
_, err := w.Write([]byte("some export blah blah 1234567890"))
|
||||
return 1000, err
|
||||
}
|
||||
|
||||
@@ -73,7 +73,8 @@ func prep(t *testing.T) (srv *Rest, ts *httptest.Server) {
|
||||
}
|
||||
srv.ScoreThresholds.Low, srv.ScoreThresholds.Critical = -5, -10
|
||||
|
||||
ioutil.WriteFile(testHTML, []byte("some html"), 0700)
|
||||
err = ioutil.WriteFile(testHTML, []byte("some html"), 0700)
|
||||
assert.Nil(t, err)
|
||||
ts = httptest.NewServer(srv.routes())
|
||||
return srv, ts
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ func TestJWT_SetAndGetWithCookies(t *testing.T) {
|
||||
|
||||
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
if r.URL.Path == "/valid" {
|
||||
j.Set(w, claims, true)
|
||||
assert.Nil(t, j.Set(w, claims, true))
|
||||
w.WriteHeader(200)
|
||||
}
|
||||
}))
|
||||
@@ -193,7 +193,7 @@ func TestJWT_SetAndGetWithXsrfMismatch(t *testing.T) {
|
||||
|
||||
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
if r.URL.Path == "/valid" {
|
||||
j.Set(w, claims, true)
|
||||
assert.Nil(t, j.Set(w, claims, true))
|
||||
w.WriteHeader(200)
|
||||
}
|
||||
}))
|
||||
@@ -230,7 +230,7 @@ func TestJWT_SetAndGetWithCookiesExpired(t *testing.T) {
|
||||
|
||||
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
if r.URL.Path == "/expired" {
|
||||
j.Set(w, claims, true)
|
||||
assert.Nil(t, j.Set(w, claims, true))
|
||||
w.WriteHeader(200)
|
||||
}
|
||||
}))
|
||||
|
||||
Vendored
+2
-2
@@ -226,11 +226,11 @@ func TestMemoryCache_Scopes(t *testing.T) {
|
||||
lc.Flush("s1")
|
||||
assert.Equal(t, 1, lc.(*memoryCache).bytesCache.Len())
|
||||
|
||||
lc.Get(Key("key2", "s2"), func() ([]byte, error) {
|
||||
_, err = lc.Get(Key("key2", "s2"), func() ([]byte, error) {
|
||||
assert.Fail(t, "should stay")
|
||||
return nil, nil
|
||||
})
|
||||
|
||||
assert.Nil(t, err)
|
||||
res, err = lc.Get(Key("key", "s1", "s2"), func() ([]byte, error) {
|
||||
return []byte("value-upd"), nil
|
||||
})
|
||||
|
||||
@@ -55,7 +55,8 @@ func TestAvatarStore_Get(t *testing.T) {
|
||||
p := NewFSAvatarStore("/tmp/avatars.test", 300)
|
||||
os.MkdirAll("/tmp/avatars.test/30", 0700)
|
||||
defer os.RemoveAll("/tmp/avatars.test")
|
||||
ioutil.WriteFile("/tmp/avatars.test/30/b3daa77b4c04a9551b8781d03191fe098f325e67.image", []byte("something"), 0666)
|
||||
err := ioutil.WriteFile("/tmp/avatars.test/30/b3daa77b4c04a9551b8781d03191fe098f325e67.image", []byte("something"), 0666)
|
||||
assert.Nil(t, err)
|
||||
r, size, err := p.Get("b3daa77b4c04a9551b8781d03191fe098f325e67.image")
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, 9, size)
|
||||
|
||||
Reference in New Issue
Block a user