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/update_test.go | |
parent | 75f0b0c51c1642551aebd83a1601187cfe89d172 (diff) | |
download | gitea-8093b3372e812af6a5c3aab32559881011861243.tar.gz gitea-8093b3372e812af6a5c3aab32559881011861243.zip |
Less boilerplate in models/ unit tests (#725)
Diffstat (limited to 'models/update_test.go')
-rw-r--r-- | models/update_test.go | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/models/update_test.go b/models/update_test.go index 6d044c08df..db9d7b94b9 100644 --- a/models/update_test.go +++ b/models/update_test.go @@ -23,13 +23,7 @@ func TestAddUpdateTask(t *testing.T) { NewCommitID: "newCommitId4", } assert.NoError(t, AddUpdateTask(task)) - - sess := x.NewSession() - defer sess.Close() - has, err := sess.Get(task) - assert.NoError(t, err) - assert.True(t, has) - assert.Equal(t, "uuid4", task.UUID) + AssertExistsAndLoadBean(t, task) } func TestGetUpdateTaskByUUID(t *testing.T) { @@ -49,11 +43,7 @@ func TestGetUpdateTaskByUUID(t *testing.T) { func TestDeleteUpdateTaskByUUID(t *testing.T) { assert.NoError(t, PrepareTestDatabase()) assert.NoError(t, DeleteUpdateTaskByUUID("uuid1")) - sess := x.NewSession() - defer sess.Close() - has, err := sess.Get(&UpdateTask{UUID: "uuid1"}) - assert.NoError(t, err) - assert.False(t, has) + AssertNotExistsBean(t, &UpdateTask{UUID: "uuid1"}) assert.NoError(t, DeleteUpdateTaskByUUID("invalid")) } |