forked from forgejo/forgejo
Consistency checks for unit tests (#853)
This commit is contained in:
parent
94130da63a
commit
ceae143e78
6 changed files with 182 additions and 12 deletions
|
@ -56,6 +56,11 @@ func CreateTestEngine() error {
|
|||
return err
|
||||
}
|
||||
|
||||
func TestFixturesAreConsistent(t *testing.T) {
|
||||
assert.NoError(t, PrepareTestDatabase())
|
||||
CheckConsistencyForAll(t)
|
||||
}
|
||||
|
||||
// PrepareTestDatabase load test fixtures into test database
|
||||
func PrepareTestDatabase() error {
|
||||
return fixtures.Load()
|
||||
|
@ -84,7 +89,8 @@ func AssertExistsAndLoadBean(t *testing.T, bean interface{}, conditions ...inter
|
|||
exists, err := loadBeanIfExists(bean, conditions...)
|
||||
assert.NoError(t, err)
|
||||
assert.True(t, exists,
|
||||
"Expected to find %+v (with conditions %+v), but did not", bean, conditions)
|
||||
"Expected to find %+v (of type %T, with conditions %+v), but did not",
|
||||
bean, bean, conditions)
|
||||
return bean
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue