diff options
author | ᴜɴᴋɴᴡᴏɴ <u@gogs.io> | 2020-04-11 01:25:19 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-11 01:25:19 +0800 |
commit | 62dda96159055ff9d485078f257445b964eb5220 (patch) | |
tree | a8bd161dc92c368bee0e6b58797e23278565cd8b /internal/db/main_test.go | |
parent | 5753d4cb87388c247e91eaf3ce641d309a45e760 (diff) |
access_token: migrate to GORM and add tests (#6086)
* access_token: migrate to GORM
* Add tests
* Fix tests
* Fix test clock
Diffstat (limited to 'internal/db/main_test.go')
-rw-r--r-- | internal/db/main_test.go | 11 |
1 files changed, 11 insertions, 0 deletions
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 +} |