diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2017-01-28 00:11:41 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-28 00:11:41 +0800 |
commit | bb5a6b7a07125b29604f479f45e59073cb3d4648 (patch) | |
tree | 590eeb774f6cb16bc8f8b12dc8f92fb6fd11b443 /models/access_test.go | |
parent | 25663b58161c48bdc8e9cae900544378dede0d2b (diff) | |
download | gitea-bb5a6b7a07125b29604f479f45e59073cb3d4648.tar.gz gitea-bb5a6b7a07125b29604f479f45e59073cb3d4648.zip |
fix xorm NewSession uncorrected usages (#774)
Diffstat (limited to 'models/access_test.go')
-rw-r--r-- | models/access_test.go | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/models/access_test.go b/models/access_test.go index 8d8b156ccd..e06db5607b 100644 --- a/models/access_test.go +++ b/models/access_test.go @@ -98,16 +98,12 @@ func TestRepository_RecalculateAccesses(t *testing.T) { repo1 := AssertExistsAndLoadBean(t, &Repository{ID: 3}).(*Repository) assert.NoError(t, repo1.GetOwner()) - sess := x.NewSession() - defer sess.Close() - _, err := sess.Delete(&Collaboration{UserID: 2, RepoID: 3}) + _, err := x.Delete(&Collaboration{UserID: 2, RepoID: 3}) assert.NoError(t, err) - assert.NoError(t, repo1.RecalculateAccesses()) - sess = x.NewSession() access := &Access{UserID: 2, RepoID: 3} - has, err := sess.Get(access) + has, err := x.Get(access) assert.NoError(t, err) assert.True(t, has) assert.Equal(t, AccessModeWrite, access.Mode) @@ -119,15 +115,11 @@ func TestRepository_RecalculateAccesses2(t *testing.T) { repo1 := AssertExistsAndLoadBean(t, &Repository{ID: 4}).(*Repository) assert.NoError(t, repo1.GetOwner()) - sess := x.NewSession() - defer sess.Close() - _, err := sess.Delete(&Collaboration{UserID: 4, RepoID: 4}) + _, err := x.Delete(&Collaboration{UserID: 4, RepoID: 4}) assert.NoError(t, err) - assert.NoError(t, repo1.RecalculateAccesses()) - sess = x.NewSession() - has, err := sess.Get(&Access{UserID: 4, RepoID: 4}) + has, err := x.Get(&Access{UserID: 4, RepoID: 4}) assert.NoError(t, err) assert.False(t, has) } |