Fix bug on admin subcommand (#17533)

* Fix bug on admin subcommand

* Add signals for all initDB

Co-authored-by: Lauris BH <lauris@nix.lv>
This commit is contained in:
Lunny Xiao 2021-11-07 11:11:27 +08:00 committed by GitHub
parent c9110eb5e4
commit 69b61d4373
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 120 additions and 79 deletions

View file

@ -5,6 +5,7 @@
package cmd
import (
"context"
"testing"
"code.gitea.io/gitea/models/login"
@ -207,7 +208,7 @@ func TestAddLdapBindDn(t *testing.T) {
// Mock functions.
var createdLoginSource *login.Source
service := &authService{
initDB: func() error {
initDB: func(context.Context) error {
return nil
},
createLoginSource: func(loginSource *login.Source) error {
@ -438,7 +439,7 @@ func TestAddLdapSimpleAuth(t *testing.T) {
// Mock functions.
var createdLoginSource *login.Source
service := &authService{
initDB: func() error {
initDB: func(context.Context) error {
return nil
},
createLoginSource: func(loginSource *login.Source) error {
@ -863,7 +864,7 @@ func TestUpdateLdapBindDn(t *testing.T) {
// Mock functions.
var updatedLoginSource *login.Source
service := &authService{
initDB: func() error {
initDB: func(context.Context) error {
return nil
},
createLoginSource: func(loginSource *login.Source) error {
@ -1227,7 +1228,7 @@ func TestUpdateLdapSimpleAuth(t *testing.T) {
// Mock functions.
var updatedLoginSource *login.Source
service := &authService{
initDB: func() error {
initDB: func(context.Context) error {
return nil
},
createLoginSource: func(loginSource *login.Source) error {