diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2022-05-20 22:08:52 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-20 22:08:52 +0800 |
commit | fd7d83ace60258acf7139c4c787aa8af75b7ba8c (patch) | |
tree | 50038348ec10485f72344f3ac80324e04abc1283 /models/repo/watch_test.go | |
parent | d81e31ad7826a81fc7139f329f250594610a274b (diff) | |
download | gitea-fd7d83ace60258acf7139c4c787aa8af75b7ba8c.tar.gz gitea-fd7d83ace60258acf7139c4c787aa8af75b7ba8c.zip |
Move almost all functions' parameter db.Engine to context.Context (#19748)
* Move almost all functions' parameter db.Engine to context.Context
* remove some unnecessary wrap functions
Diffstat (limited to 'models/repo/watch_test.go')
-rw-r--r-- | models/repo/watch_test.go | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/models/repo/watch_test.go b/models/repo/watch_test.go index 2ff3ced2dc..2f4e04ab17 100644 --- a/models/repo/watch_test.go +++ b/models/repo/watch_test.go @@ -73,13 +73,13 @@ func TestWatchIfAuto(t *testing.T) { prevCount := repo.NumWatches // Must not add watch - assert.NoError(t, WatchIfAuto(8, 1, true)) + assert.NoError(t, WatchIfAuto(db.DefaultContext, 8, 1, true)) watchers, err = GetRepoWatchers(repo.ID, db.ListOptions{Page: 1}) assert.NoError(t, err) assert.Len(t, watchers, prevCount) // Should not add watch - assert.NoError(t, WatchIfAuto(10, 1, true)) + assert.NoError(t, WatchIfAuto(db.DefaultContext, 10, 1, true)) watchers, err = GetRepoWatchers(repo.ID, db.ListOptions{Page: 1}) assert.NoError(t, err) assert.Len(t, watchers, prevCount) @@ -87,31 +87,31 @@ func TestWatchIfAuto(t *testing.T) { setting.Service.AutoWatchOnChanges = true // Must not add watch - assert.NoError(t, WatchIfAuto(8, 1, true)) + assert.NoError(t, WatchIfAuto(db.DefaultContext, 8, 1, true)) watchers, err = GetRepoWatchers(repo.ID, db.ListOptions{Page: 1}) assert.NoError(t, err) assert.Len(t, watchers, prevCount) // Should not add watch - assert.NoError(t, WatchIfAuto(12, 1, false)) + assert.NoError(t, WatchIfAuto(db.DefaultContext, 12, 1, false)) watchers, err = GetRepoWatchers(repo.ID, db.ListOptions{Page: 1}) assert.NoError(t, err) assert.Len(t, watchers, prevCount) // Should add watch - assert.NoError(t, WatchIfAuto(12, 1, true)) + assert.NoError(t, WatchIfAuto(db.DefaultContext, 12, 1, true)) watchers, err = GetRepoWatchers(repo.ID, db.ListOptions{Page: 1}) assert.NoError(t, err) assert.Len(t, watchers, prevCount+1) // Should remove watch, inhibit from adding auto - assert.NoError(t, WatchRepo(12, 1, false)) + assert.NoError(t, WatchRepo(db.DefaultContext, 12, 1, false)) watchers, err = GetRepoWatchers(repo.ID, db.ListOptions{Page: 1}) assert.NoError(t, err) assert.Len(t, watchers, prevCount) // Must not add watch - assert.NoError(t, WatchIfAuto(12, 1, true)) + assert.NoError(t, WatchIfAuto(db.DefaultContext, 12, 1, true)) watchers, err = GetRepoWatchers(repo.ID, db.ListOptions{Page: 1}) assert.NoError(t, err) assert.Len(t, watchers, prevCount) |