You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

repo_watch_test.go 818B

12345678910111213141516171819202122232425
  1. // Copyright 2019 The Gitea Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package integrations
  5. import (
  6. "net/url"
  7. "testing"
  8. "code.gitea.io/gitea/models"
  9. "code.gitea.io/gitea/models/unittest"
  10. "code.gitea.io/gitea/modules/setting"
  11. )
  12. func TestRepoWatch(t *testing.T) {
  13. onGiteaRun(t, func(t *testing.T, giteaURL *url.URL) {
  14. // Test round-trip auto-watch
  15. setting.Service.AutoWatchOnChanges = true
  16. session := loginUser(t, "user2")
  17. unittest.AssertNotExistsBean(t, &models.Watch{UserID: 2, RepoID: 3})
  18. testEditFile(t, session, "user3", "repo3", "master", "README.md", "Hello, World (Edited for watch)\n")
  19. unittest.AssertExistsAndLoadBean(t, &models.Watch{UserID: 2, RepoID: 3, Mode: models.RepoWatchModeAuto})
  20. })
  21. }