1
Fork 0

Merge pull request '[SEC] Notify owner about TOTP enrollment' (#4704) from gusted/sec-more-totp into forgejo

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4704
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
This commit is contained in:
Gusted 2024-07-27 20:53:47 +00:00
commit 4c40bf5d29
6 changed files with 137 additions and 0 deletions

View file

@ -9,6 +9,7 @@ import (
"code.gitea.io/gitea/models/db"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"xorm.io/builder"
)
@ -130,6 +131,12 @@ func AssertSuccessfulInsert(t assert.TestingT, beans ...any) {
assert.NoError(t, err)
}
// AssertSuccessfulDelete assert that beans is successfully deleted
func AssertSuccessfulDelete(t require.TestingT, beans ...any) {
err := db.DeleteBeans(db.DefaultContext, beans...)
require.NoError(t, err)
}
// AssertCount assert the count of a bean
func AssertCount(t assert.TestingT, bean, expected any) bool {
return assert.EqualValues(t, expected, GetCount(t, bean))