1
0
Fork 0
forked from forgejo/forgejo

Consistency checks for unit tests (#853)

This commit is contained in:
Ethan Koenig 2017-02-07 06:47:55 -05:00 committed by Lunny Xiao
parent 94130da63a
commit ceae143e78
6 changed files with 182 additions and 12 deletions

View file

@ -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
}