gogs/internal/database/mocks.go

34 lines
620 B
Go

// Copyright 2020 The Gogs Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package database
import (
"testing"
)
func SetMockReposStore(t *testing.T, mock ReposStore) {
before := Repos
Repos = mock
t.Cleanup(func() {
Repos = before
})
}
func SetMockTwoFactorsStore(t *testing.T, mock TwoFactorsStore) {
before := TwoFactors
TwoFactors = mock
t.Cleanup(func() {
TwoFactors = before
})
}
func SetMockUsersStore(t *testing.T, mock UsersStore) {
before := Users
Users = mock
t.Cleanup(func() {
Users = before
})
}