diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2021-12-12 23:48:20 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-12 23:48:20 +0800 |
commit | 572324049008ac803d3d7c17a7b3a81ef00386fc (patch) | |
tree | a9c3709643a23165d27aa67e76f10f26a89936d5 /models/action_test.go | |
parent | 0a7e8327a017c5dd43e552bbcd0d0f056bc1671b (diff) | |
download | gitea-572324049008ac803d3d7c17a7b3a81ef00386fc.tar.gz gitea-572324049008ac803d3d7c17a7b3a81ef00386fc.zip |
Some repository refactors (#17950)
* some repository refactors
* remove unnecessary code
* Fix test
* Remove unnecessary banner
Diffstat (limited to 'models/action_test.go')
-rw-r--r-- | models/action_test.go | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/models/action_test.go b/models/action_test.go index 02edae2df7..306d382364 100644 --- a/models/action_test.go +++ b/models/action_test.go @@ -92,3 +92,40 @@ func TestGetFeeds2(t *testing.T) { assert.NoError(t, err) assert.Len(t, actions, 0) } + +func TestNotifyWatchers(t *testing.T) { + assert.NoError(t, unittest.PrepareTestDatabase()) + + action := &Action{ + ActUserID: 8, + RepoID: 1, + OpType: ActionStarRepo, + } + assert.NoError(t, NotifyWatchers(action)) + + // One watchers are inactive, thus action is only created for user 8, 1, 4, 11 + unittest.AssertExistsAndLoadBean(t, &Action{ + ActUserID: action.ActUserID, + UserID: 8, + RepoID: action.RepoID, + OpType: action.OpType, + }) + unittest.AssertExistsAndLoadBean(t, &Action{ + ActUserID: action.ActUserID, + UserID: 1, + RepoID: action.RepoID, + OpType: action.OpType, + }) + unittest.AssertExistsAndLoadBean(t, &Action{ + ActUserID: action.ActUserID, + UserID: 4, + RepoID: action.RepoID, + OpType: action.OpType, + }) + unittest.AssertExistsAndLoadBean(t, &Action{ + ActUserID: action.ActUserID, + UserID: 11, + RepoID: action.RepoID, + OpType: action.OpType, + }) +} |