mirror of
https://codeberg.org/davrot/forgejo.git
synced 2025-05-18 17:00:02 +02:00
Less boilerplate in models/ unit tests (#725)
This commit is contained in:
parent
75f0b0c51c
commit
8093b3372e
6 changed files with 47 additions and 113 deletions
|
@ -59,10 +59,11 @@ func loadBeanIfExists(bean interface{}, conditions ...interface{}) (bool, error)
|
|||
|
||||
// AssertExistsAndLoadBean assert that a bean exists and load it from the test
|
||||
// database
|
||||
func AssertExistsAndLoadBean(t *testing.T, bean interface{}, conditions ...interface{}) {
|
||||
func AssertExistsAndLoadBean(t *testing.T, bean interface{}, conditions ...interface{}) interface{} {
|
||||
exists, err := loadBeanIfExists(bean, conditions...)
|
||||
assert.NoError(t, err)
|
||||
assert.True(t, exists)
|
||||
return bean
|
||||
}
|
||||
|
||||
// AssertNotExistsBean assert that a bean does not exist in the test database
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue