From 62dda96159055ff9d485078f257445b964eb5220 Mon Sep 17 00:00:00 2001 From: ᴜɴᴋɴᴡᴏɴ Date: Sat, 11 Apr 2020 01:25:19 +0800 Subject: access_token: migrate to GORM and add tests (#6086) * access_token: migrate to GORM * Add tests * Fix tests * Fix test clock --- internal/db/main_test.go | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'internal/db/main_test.go') diff --git a/internal/db/main_test.go b/internal/db/main_test.go index 24393f5b..d141d3cd 100644 --- a/internal/db/main_test.go +++ b/internal/db/main_test.go @@ -10,6 +10,7 @@ import ( "os" "testing" + "github.com/jinzhu/gorm" log "unknwon.dev/clog/v2" "gogs.io/gogs/internal/testutil" @@ -28,3 +29,13 @@ func TestMain(m *testing.M) { } os.Exit(m.Run()) } + +func deleteTables(db *gorm.DB, tables ...interface{}) error { + for _, t := range tables { + err := db.Delete(t).Error + if err != nil { + return err + } + } + return nil +} -- cgit v1.2.3