diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2017-10-25 01:36:19 +0800 |
---|---|---|
committer | Lauris BH <lauris@nix.lv> | 2017-10-24 20:36:19 +0300 |
commit | 6eeadb2082193f8e3dc5269dfc6da2daef7eb6a1 (patch) | |
tree | d28d3be3451194e98a5c01097347e7eebdb6393f /models/repo_watch_test.go | |
parent | 03900303a9500b33b33ff03fd6dd325147a1117e (diff) | |
download | gitea-6eeadb2082193f8e3dc5269dfc6da2daef7eb6a1.tar.gz gitea-6eeadb2082193f8e3dc5269dfc6da2daef7eb6a1.zip |
Hide unactive on explore users and some refactors (#2741)
* hide unactive on explore users and some refactors
* fix test for removed Organizations
* fix test for removed Organizations
* fix imports
* fix logic bug
* refactor the toConds
* Rename TestOrganizations to TestSearchUsers and add tests for users
* fix other tests
* fix other tests
* fix watchers tests
* fix comments and remove unused code
Diffstat (limited to 'models/repo_watch_test.go')
-rw-r--r-- | models/repo_watch_test.go | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/models/repo_watch_test.go b/models/repo_watch_test.go index 1277b156c5..852f09f1c7 100644 --- a/models/repo_watch_test.go +++ b/models/repo_watch_test.go @@ -40,8 +40,8 @@ func TestGetWatchers(t *testing.T) { repo := AssertExistsAndLoadBean(t, &Repository{ID: 1}).(*Repository) watches, err := GetWatchers(repo.ID) assert.NoError(t, err) - // Two watchers are inactive, thus minus 2 - assert.Len(t, watches, repo.NumWatches-2) + // One watchers are inactive, thus minus 1 + assert.Len(t, watches, repo.NumWatches-1) for _, watch := range watches { assert.EqualValues(t, repo.ID, watch.RepoID) } @@ -62,7 +62,7 @@ func TestRepository_GetWatchers(t *testing.T) { AssertExistsAndLoadBean(t, &Watch{UserID: watcher.ID, RepoID: repo.ID}) } - repo = AssertExistsAndLoadBean(t, &Repository{ID: 10}).(*Repository) + repo = AssertExistsAndLoadBean(t, &Repository{ID: 9}).(*Repository) watchers, err = repo.GetWatchers(1) assert.NoError(t, err) assert.Len(t, watchers, 0) @@ -78,7 +78,7 @@ func TestNotifyWatchers(t *testing.T) { } assert.NoError(t, NotifyWatchers(action)) - // Two watchers are inactive, thus action is only created for user 8, 10 + // One watchers are inactive, thus action is only created for user 8, 1, 4 AssertExistsAndLoadBean(t, &Action{ ActUserID: action.ActUserID, UserID: 8, @@ -87,7 +87,13 @@ func TestNotifyWatchers(t *testing.T) { }) AssertExistsAndLoadBean(t, &Action{ ActUserID: action.ActUserID, - UserID: 10, + UserID: 1, + RepoID: action.RepoID, + OpType: action.OpType, + }) + AssertExistsAndLoadBean(t, &Action{ + ActUserID: action.ActUserID, + UserID: 4, RepoID: action.RepoID, OpType: action.OpType, }) |