diff options
author | 赵智超 <1012112796@qq.com> | 2020-10-13 03:55:13 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-12 20:55:13 +0100 |
commit | 8be3e439c2b3a90fcb639b732008486b85314b8d (patch) | |
tree | 0d941779b1c545c4bfa41d8d54c1bf0f219a43eb /models/repo_test.go | |
parent | b546eda7a8fa17d86cf9722c9f7bcca009d40443 (diff) | |
download | gitea-8be3e439c2b3a90fcb639b732008486b85314b8d.tar.gz gitea-8be3e439c2b3a90fcb639b732008486b85314b8d.zip |
Add team support for review request (#12039)
Add team support for review request
Block #11355
Signed-off-by: a1012112796 <1012112796@qq.com>
Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'models/repo_test.go')
-rw-r--r-- | models/repo_test.go | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/models/repo_test.go b/models/repo_test.go index 045f94670b..a366772d5c 100644 --- a/models/repo_test.go +++ b/models/repo_test.go @@ -193,3 +193,34 @@ func TestDoctorUserStarNum(t *testing.T) { assert.NoError(t, DoctorUserStarNum()) } + +func TestRepoGetReviewers(t *testing.T) { + assert.NoError(t, PrepareTestDatabase()) + + // test public repo + repo1 := AssertExistsAndLoadBean(t, &Repository{ID: 1}).(*Repository) + + reviewers, err := repo1.GetReviewers(2, 2) + assert.NoError(t, err) + assert.Equal(t, 4, len(reviewers)) + + // test private repo + repo2 := AssertExistsAndLoadBean(t, &Repository{ID: 2}).(*Repository) + reviewers, err = repo2.GetReviewers(2, 2) + assert.NoError(t, err) + assert.Equal(t, 0, len(reviewers)) +} + +func TestRepoGetReviewerTeams(t *testing.T) { + assert.NoError(t, PrepareTestDatabase()) + + repo2 := AssertExistsAndLoadBean(t, &Repository{ID: 2}).(*Repository) + teams, err := repo2.GetReviewerTeams() + assert.NoError(t, err) + assert.Empty(t, teams) + + repo3 := AssertExistsAndLoadBean(t, &Repository{ID: 3}).(*Repository) + teams, err = repo3.GetReviewerTeams() + assert.NoError(t, err) + assert.Equal(t, 2, len(teams)) +} |