aboutsummaryrefslogtreecommitdiffstats
path: root/models/repo/watch_test.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2022-05-20 22:08:52 +0800
committerGitHub <noreply@github.com>2022-05-20 22:08:52 +0800
commitfd7d83ace60258acf7139c4c787aa8af75b7ba8c (patch)
tree50038348ec10485f72344f3ac80324e04abc1283 /models/repo/watch_test.go
parentd81e31ad7826a81fc7139f329f250594610a274b (diff)
downloadgitea-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.go14
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)