summaryrefslogtreecommitdiffstats
path: root/models/org_test.go
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2021-09-23 17:45:36 +0200
committerGitHub <noreply@github.com>2021-09-23 17:45:36 +0200
commit9302eba971611601c3ebf6024e22a11c63f4e151 (patch)
treea3e5583986161ef62e7affc694098279ecf2217d /models/org_test.go
parentFix typo skipping a migration (#17130) (diff)
downloadforgejo-9302eba971611601c3ebf6024e22a11c63f4e151.tar.xz
forgejo-9302eba971611601c3ebf6024e22a11c63f4e151.zip
DBContext is just a Context (#17100)
* DBContext is just a Context This PR removes some of the specialness from the DBContext and makes it context This allows us to simplify the GetEngine code to wrap around any context in future and means that we can change our loadRepo(e Engine) functions to simply take contexts. Signed-off-by: Andrew Thornton <art27@cantab.net> * fix unit tests Signed-off-by: Andrew Thornton <art27@cantab.net> * another place that needs to set the initial context Signed-off-by: Andrew Thornton <art27@cantab.net> * avoid race Signed-off-by: Andrew Thornton <art27@cantab.net> * change attachment error Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'models/org_test.go')
-rw-r--r--models/org_test.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/models/org_test.go b/models/org_test.go
index 9990a9d9f1..75dfc4262d 100644
--- a/models/org_test.go
+++ b/models/org_test.go
@@ -255,7 +255,7 @@ func TestGetOrgByName(t *testing.T) {
func TestCountOrganizations(t *testing.T) {
assert.NoError(t, db.PrepareTestDatabase())
- expected, err := db.DefaultContext().Engine().Where("type=?", UserTypeOrganization).Count(&User{})
+ expected, err := db.GetEngine(db.DefaultContext).Where("type=?", UserTypeOrganization).Count(&User{})
assert.NoError(t, err)
assert.Equal(t, expected, CountOrganizations())
}