diff options
author | Ethan Koenig <etk39@cornell.edu> | 2017-01-24 21:49:51 -0500 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2017-01-25 10:49:51 +0800 |
commit | 8093b3372e812af6a5c3aab32559881011861243 (patch) | |
tree | d4a4ddcb947b2d35322849a2534543e2eb7dbb3e /models/setup_for_test.go | |
parent | 75f0b0c51c1642551aebd83a1601187cfe89d172 (diff) | |
download | gitea-8093b3372e812af6a5c3aab32559881011861243.tar.gz gitea-8093b3372e812af6a5c3aab32559881011861243.zip |
Less boilerplate in models/ unit tests (#725)
Diffstat (limited to 'models/setup_for_test.go')
-rw-r--r-- | models/setup_for_test.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/models/setup_for_test.go b/models/setup_for_test.go index 7d21768945..e6f86ec685 100644 --- a/models/setup_for_test.go +++ b/models/setup_for_test.go @@ -59,10 +59,11 @@ func loadBeanIfExists(bean interface{}, conditions ...interface{}) (bool, error) // AssertExistsAndLoadBean assert that a bean exists and load it from the test // database -func AssertExistsAndLoadBean(t *testing.T, bean interface{}, conditions ...interface{}) { +func AssertExistsAndLoadBean(t *testing.T, bean interface{}, conditions ...interface{}) interface{} { exists, err := loadBeanIfExists(bean, conditions...) assert.NoError(t, err) assert.True(t, exists) + return bean } // AssertNotExistsBean assert that a bean does not exist in the test database |