Browse Source

Close database after all tests

master
Jan-Lukas Else 4 months ago
parent
commit
9eb9b50c0a
  1. 1
      activityPub_test.go
  2. 1
      authentication_test.go
  3. 1
      blogroll_test.go
  4. 1
      blogstats_test.go
  5. 1
      captcha_test.go
  6. 1
      comments_test.go
  7. 1
      contact_test.go
  8. 1
      editor_test.go
  9. 1
      errors_test.go
  10. 1
      export_test.go
  11. 1
      feeds_test.go
  12. 1
      geoTrack_test.go
  13. 1
      indexnow_test.go
  14. 1
      indieAuthServer_test.go
  15. 1
      indieAuth_test.go
  16. 1
      ntfy_test.go
  17. 4
      postsDb_test.go
  18. 1
      postsDeleter_test.go
  19. 1
      postsScheduler_test.go
  20. 2
      posts_test.go
  21. 1
      privateMode_test.go
  22. 1
      queue_test.go
  23. 1
      shortPath_test.go
  24. 1
      sitemap_test.go
  25. 2
      telegram_test.go
  26. 4
      ui_test.go
  27. 3
      webmentionVerification_test.go
  28. 1
      webmention_test.go

1
activityPub_test.go

@ -20,6 +20,7 @@ func Test_loadActivityPubPrivateKey(t *testing.T) {
},
}
_ = app.initDatabase(false)
defer app.db.close()
// Generate
err := app.loadActivityPubPrivateKey()

1
authentication_test.go

@ -31,6 +31,7 @@ func Test_authMiddleware(t *testing.T) {
_ = app.initConfig()
_ = app.initDatabase(false)
defer app.db.close()
app.initComponents(false)
app.d = http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {

1
blogroll_test.go

@ -43,6 +43,7 @@ func Test_blogroll(t *testing.T) {
}
_ = app.initDatabase(false)
defer app.db.close()
app.initComponents(false)
fc.setFakeResponse(200, `

1
blogstats_test.go

@ -43,6 +43,7 @@ func Test_blogStats(t *testing.T) {
}
_ = app.initDatabase(false)
defer app.db.close()
app.initComponents(false)
// Insert post

1
captcha_test.go

@ -25,6 +25,7 @@ func Test_captchaMiddleware(t *testing.T) {
_ = app.initConfig()
_ = app.initDatabase(false)
defer app.db.close()
app.initComponents(false)
app.d = alice.New(app.checkIsCaptcha, app.captchaMiddleware).ThenFunc(func(rw http.ResponseWriter, r *http.Request) {

1
comments_test.go

@ -37,6 +37,7 @@ func Test_comments(t *testing.T) {
}
_ = app.initDatabase(false)
defer app.db.close()
app.initComponents(false)
t.Run("Successful comment", func(t *testing.T) {

1
contact_test.go

@ -52,6 +52,7 @@ func Test_contact(t *testing.T) {
},
}
_ = app.initDatabase(false)
defer app.db.close()
app.initComponents(false)
// Make contact form request

1
editor_test.go

@ -17,6 +17,7 @@ func Test_editorPreview(t *testing.T) {
}
_ = app.initConfig()
_ = app.initDatabase(false)
defer app.db.close()
app.initComponents(false)
h := http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {

1
errors_test.go

@ -31,6 +31,7 @@ func Test_errors(t *testing.T) {
}
_ = app.initDatabase(false)
defer app.db.close()
app.initComponents(false)
t.Run("Test 404, no HTML", func(t *testing.T) {

1
export_test.go

@ -18,6 +18,7 @@ func Test_export(t *testing.T) {
},
}
_ = app.initDatabase(false)
defer app.db.close()
app.initMarkdown()
err := app.db.savePost(&post{

1
feeds_test.go

@ -17,6 +17,7 @@ func Test_feeds(t *testing.T) {
}
_ = app.initConfig()
_ = app.initDatabase(false)
defer app.db.close()
app.initComponents(false)
app.d, _ = app.buildRouter()
handlerClient := newHandlerClient(app.d)

1
geoTrack_test.go

@ -28,6 +28,7 @@ func Test_geoTrack(t *testing.T) {
}
_ = app.initDatabase(false)
defer app.db.close()
app.initComponents(false)
// First test (just with track)

1
indexnow_test.go

@ -20,6 +20,7 @@ func Test_indexNow(t *testing.T) {
app.cfg.IndexNow = &configIndexNow{Enabled: true}
_ = app.initConfig()
_ = app.initDatabase(false)
defer app.db.close()
app.initComponents(false)
// Create http router

1
indieAuthServer_test.go

@ -49,6 +49,7 @@ func Test_indieAuthServer(t *testing.T) {
require.NoError(t, err)
_ = app.initDatabase(false)
defer app.db.close()
app.initComponents(false)
app.ias.Client = newHandlerClient(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {

1
indieAuth_test.go

@ -30,6 +30,7 @@ func Test_checkIndieAuth(t *testing.T) {
}
_ = app.initDatabase(false)
defer app.db.close()
app.initComponents(false)
req := httptest.NewRequest(http.MethodGet, "/", nil)

1
ntfy_test.go

@ -26,6 +26,7 @@ func Test_ntfySending(t *testing.T) {
_ = app.initConfig()
_ = app.initDatabase(false)
defer app.db.close()
app.initComponents(false)
app.sendNotification("Test notification")

4
postsDb_test.go

@ -26,6 +26,7 @@ func Test_postsDb(t *testing.T) {
}
_ = app.initConfig()
_ = app.initDatabase(false)
defer app.db.close()
app.initComponents(false)
now := toLocalSafe(time.Now().String())
@ -234,6 +235,7 @@ func Test_ftsWithoutTitle(t *testing.T) {
},
}
_ = app.initDatabase(false)
defer app.db.close()
app.initMarkdown()
err := app.db.savePost(&post{
@ -265,6 +267,7 @@ func Test_postsPriority(t *testing.T) {
},
}
_ = app.initDatabase(false)
defer app.db.close()
app.initMarkdown()
err := app.db.savePost(&post{
@ -315,6 +318,7 @@ func Test_usesOfMediaFile(t *testing.T) {
},
}
_ = app.initDatabase(false)
defer app.db.close()
err := app.db.savePost(&post{
Path: "/test/abc",

1
postsDeleter_test.go

@ -13,6 +13,7 @@ func Test_checkDeletedPosts(t *testing.T) {
}
_ = app.initConfig()
_ = app.initDatabase(false)
defer app.db.close()
app.initComponents(false)
// Create a post

1
postsScheduler_test.go

@ -33,6 +33,7 @@ func Test_postsScheduler(t *testing.T) {
}
_ = app.initDatabase(false)
defer app.db.close()
app.initComponents(false)
err := app.db.savePost(&post{

2
posts_test.go

@ -18,6 +18,7 @@ func Test_serveDate(t *testing.T) {
}
_ = app.initConfig()
_ = app.initDatabase(false)
defer app.db.close()
app.initComponents(false)
app.d, err = app.buildRouter()
@ -108,6 +109,7 @@ func Test_servePost(t *testing.T) {
})
_ = app.initConfig()
_ = app.initDatabase(false)
defer app.db.close()
app.initComponents(false)
app.d, err = app.buildRouter()

1
privateMode_test.go

@ -46,6 +46,7 @@ func Test_privateMode(t *testing.T) {
}
_ = app.initDatabase(false)
defer app.db.close()
app.initComponents(false)
handler := alice.New(middleware.WithValue(blogKey, "en"), app.privateModeHandler).ThenFunc(func(rw http.ResponseWriter, r *http.Request) {

1
queue_test.go

@ -18,6 +18,7 @@ func Test_queue(t *testing.T) {
},
}
_ = app.initDatabase(false)
defer app.db.close()
db := app.db
err := db.enqueue("test", []byte(""), time.Now())

1
shortPath_test.go

@ -17,6 +17,7 @@ func Test_shortenPath(t *testing.T) {
},
}
_ = app.initDatabase(false)
defer app.db.close()
db := app.db
res1, err := db.shortenPath("/a")

1
sitemap_test.go

@ -18,6 +18,7 @@ func Test_sitemap(t *testing.T) {
}
_ = app.initConfig()
_ = app.initDatabase(false)
defer app.db.close()
app.initComponents(false)
app.d, err = app.buildRouter()

2
telegram_test.go

@ -124,6 +124,7 @@ func Test_telegram(t *testing.T) {
}
_ = app.initConfig()
_ = app.initDatabase(false)
defer app.db.close()
app.initMarkdown()
app.initTelegram()
@ -157,6 +158,7 @@ func Test_telegram(t *testing.T) {
_ = app.initConfig()
_ = app.initDatabase(false)
defer app.db.close()
app.initTelegram()

4
ui_test.go

@ -21,6 +21,7 @@ func Test_renderPostTax(t *testing.T) {
}
_ = app.initConfig()
_ = app.initDatabase(false)
defer app.db.close()
app.initComponents(false)
p := &post{
@ -47,6 +48,7 @@ func Test_renderOldContentWarning(t *testing.T) {
}
_ = app.initConfig()
_ = app.initDatabase(false)
defer app.db.close()
app.initComponents(false)
p := &post{
@ -74,6 +76,7 @@ func Test_renderInteractions(t *testing.T) {
app.cfg.Server.PublicAddress = "https://example.com"
_ = app.initConfig()
_ = app.initDatabase(false)
defer app.db.close()
app.initComponents(false)
app.d, err = app.buildRouter()
require.NoError(t, err)
@ -140,6 +143,7 @@ func Test_renderAuthor(t *testing.T) {
app.cfg.User.Name = "John Doe"
_ = app.initConfig()
_ = app.initDatabase(false)
defer app.db.close()
app.initComponents(false)
buf := &bytes.Buffer{}

3
webmentionVerification_test.go

@ -37,6 +37,7 @@ func Test_verifyMention(t *testing.T) {
}
_ = app.initDatabase(false)
defer app.db.close()
app.initComponents(false)
m := &mention{
@ -84,6 +85,7 @@ func Test_verifyMentionBidgy(t *testing.T) {
}
_ = app.initDatabase(false)
defer app.db.close()
app.initComponents(false)
m := &mention{
@ -127,6 +129,7 @@ func Test_verifyMentionColin(t *testing.T) {
}
_ = app.initDatabase(false)
defer app.db.close()
app.initComponents(false)
m := &mention{

1
webmention_test.go

@ -29,6 +29,7 @@ func Test_webmentions(t *testing.T) {
}
_ = app.initDatabase(false)
defer app.db.close()
app.initComponents(false)
_ = app.db.insertWebmention(&mention{

Loading…
Cancel
Save