diff options
author | Ethan Koenig <ethantkoenig@gmail.com> | 2017-01-24 11:16:36 -0500 |
---|---|---|
committer | Ethan Koenig <ethantkoenig@gmail.com> | 2017-01-27 12:24:06 -0500 |
commit | a2412492da2def90457a2a20fd043bea21ef415f (patch) | |
tree | 842907cb6d69db617e5c048d23a864c8bbd6b22a /models/setup_for_test.go | |
parent | bb5a6b7a07125b29604f479f45e59073cb3d4648 (diff) | |
download | gitea-a2412492da2def90457a2a20fd043bea21ef415f.tar.gz gitea-a2412492da2def90457a2a20fd043bea21ef415f.zip |
Unit tests and bug fix for models/org
Diffstat (limited to 'models/setup_for_test.go')
-rw-r--r-- | models/setup_for_test.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/models/setup_for_test.go b/models/setup_for_test.go index 058436ca66..aec409622b 100644 --- a/models/setup_for_test.go +++ b/models/setup_for_test.go @@ -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{} { |