code.gitea.io/gitea@v1.22.3/tests/integration/repo_watch_test.go (about) 1 // Copyright 2019 The Gitea Authors. All rights reserved. 2 // SPDX-License-Identifier: MIT 3 4 package integration 5 6 import ( 7 "net/url" 8 "testing" 9 10 repo_model "code.gitea.io/gitea/models/repo" 11 "code.gitea.io/gitea/models/unittest" 12 "code.gitea.io/gitea/modules/setting" 13 ) 14 15 func TestRepoWatch(t *testing.T) { 16 onGiteaRun(t, func(t *testing.T, giteaURL *url.URL) { 17 // Test round-trip auto-watch 18 setting.Service.AutoWatchOnChanges = true 19 session := loginUser(t, "user2") 20 unittest.AssertNotExistsBean(t, &repo_model.Watch{UserID: 2, RepoID: 3}) 21 testEditFile(t, session, "org3", "repo3", "master", "README.md", "Hello, World (Edited for watch)\n") 22 unittest.AssertExistsAndLoadBean(t, &repo_model.Watch{UserID: 2, RepoID: 3, Mode: repo_model.WatchModeAuto}) 23 }) 24 }