Unit tests and bug fix for models/org

This commit is contained in:
Ethan Koenig 2017-01-24 11:16:36 -05:00
parent bb5a6b7a07
commit a2412492da
10 changed files with 671 additions and 26 deletions

View file

@ -59,6 +59,13 @@ func loadBeanIfExists(bean interface{}, conditions ...interface{}) (bool, error)
return sess.Get(bean)
}
// BeanExists for testing, check if a bean exists
func BeanExists(t *testing.T, bean interface{}, conditions ...interface{}) bool {
exists, err := loadBeanIfExists(bean, conditions...)
assert.NoError(t, err)
return exists
}
// AssertExistsAndLoadBean assert that a bean exists and load it from the test
// database
func AssertExistsAndLoadBean(t *testing.T, bean interface{}, conditions ...interface{}) interface{} {