mirror of
https://github.com/go-gitea/gitea.git
synced 2024-05-11 05:55:29 +00:00
@ -51,6 +51,7 @@ func CreateTestEngine() error {
|
||||
if err = x.StoreEngine("InnoDB").Sync2(tables...); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
fixtures, err = testfixtures.NewFolder(x.DB().DB, &testfixtures.SQLite{}, "fixtures/")
|
||||
return err
|
||||
}
|
||||
@ -82,7 +83,8 @@ func BeanExists(t *testing.T, bean interface{}, conditions ...interface{}) bool
|
||||
func AssertExistsAndLoadBean(t *testing.T, bean interface{}, conditions ...interface{}) interface{} {
|
||||
exists, err := loadBeanIfExists(bean, conditions...)
|
||||
assert.NoError(t, err)
|
||||
assert.True(t, exists)
|
||||
assert.True(t, exists,
|
||||
"Expected to find %+v (with conditions %+v), but did not", bean, conditions)
|
||||
return bean
|
||||
}
|
||||
|
||||
@ -92,3 +94,15 @@ func AssertNotExistsBean(t *testing.T, bean interface{}, conditions ...interface
|
||||
assert.NoError(t, err)
|
||||
assert.False(t, exists)
|
||||
}
|
||||
|
||||
// AssertSuccessfulInsert assert that beans is successfully inserted
|
||||
func AssertSuccessfulInsert(t *testing.T, beans ...interface{}) {
|
||||
_, err := x.Insert(beans...)
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
|
||||
// AssertSuccessfulUpdate assert that bean is successfully updated
|
||||
func AssertSuccessfulUpdate(t *testing.T, bean interface{}, conditions ...interface{}) {
|
||||
_, err := x.Update(bean, conditions...)
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
|
Reference in New Issue
Block a user