mocks.go 489 B

12345678910111213141516171819202122232425
  1. // Copyright 2020 The Gogs Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package database
  5. import (
  6. "testing"
  7. )
  8. func SetMockTwoFactorsStore(t *testing.T, mock TwoFactorsStore) {
  9. before := TwoFactors
  10. TwoFactors = mock
  11. t.Cleanup(func() {
  12. TwoFactors = before
  13. })
  14. }
  15. func SetMockUsersStore(t *testing.T, mock UsersStore) {
  16. before := Users
  17. Users = mock
  18. t.Cleanup(func() {
  19. Users = before
  20. })
  21. }