mirror of
https://github.com/go-gitea/gitea
synced 2024-12-23 19:46:06 +01:00
0af6542a34
Backport #25640 by @earl-warren - Add a few extra test cases and test functions for the collaboration model to get everything covered by tests (except for error handling, as we cannot suddenly mock errors from the database). ``` -> % go tool cover -func=coverage.out | grep "code.gitea.io/gitea/models/repo/collaboration.go" ``` Before: ``` code.gitea.io/gitea/models/repo/collaboration.go:28: init 100.0% code.gitea.io/gitea/models/repo/collaboration.go:39: GetCollaborators 61.5% code.gitea.io/gitea/models/repo/collaboration.go:65: CountCollaborators 0.0% code.gitea.io/gitea/models/repo/collaboration.go:70: GetCollaboration 0.0% code.gitea.io/gitea/models/repo/collaboration.go:83: IsCollaborator 100.0% code.gitea.io/gitea/models/repo/collaboration.go:87: getCollaborations 42.9% code.gitea.io/gitea/models/repo/collaboration.go:102: ChangeCollaborationAccessMode 77.8% code.gitea.io/gitea/models/repo/collaboration.go:141: IsOwnerMemberCollaborator 0.0% ``` After: ``` code.gitea.io/gitea/models/repo/collaboration.go:28: init 100.0% code.gitea.io/gitea/models/repo/collaboration.go:39: GetCollaborators 61.5% code.gitea.io/gitea/models/repo/collaboration.go:65: CountCollaborators 100.0% code.gitea.io/gitea/models/repo/collaboration.go:70: GetCollaboration 100.0% code.gitea.io/gitea/models/repo/collaboration.go:83: IsCollaborator 100.0% code.gitea.io/gitea/models/repo/collaboration.go:87: getCollaborations 100.0% code.gitea.io/gitea/models/repo/collaboration.go:102: ChangeCollaborationAccessMode 83.3% code.gitea.io/gitea/models/repo/collaboration.go:141: IsOwnerMemberCollaborator 87.5% ``` Co-authored-by: Gusted <postmaster@gusted.xyz> Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/825 Co-authored-by: Earl Warren <109468362+earl-warren@users.noreply.github.com> Co-authored-by: Gusted <postmaster@gusted.xyz> Co-authored-by: Gusted <gusted@noreply.codeberg.org> Co-authored-by: silverwind <me@silverwind.io> |
||
---|---|---|
.. | ||
archiver.go | ||
attachment_test.go | ||
attachment.go | ||
avatar.go | ||
collaboration_test.go | ||
collaboration.go | ||
fork_test.go | ||
fork.go | ||
git.go | ||
issue.go | ||
language_stats.go | ||
main_test.go | ||
mirror.go | ||
pushmirror_test.go | ||
pushmirror.go | ||
redirect_test.go | ||
redirect.go | ||
release.go | ||
repo_indexer.go | ||
repo_list_test.go | ||
repo_list.go | ||
repo_test.go | ||
repo_unit.go | ||
repo.go | ||
search.go | ||
star_test.go | ||
star.go | ||
topic_test.go | ||
topic.go | ||
update.go | ||
upload.go | ||
user_repo_test.go | ||
user_repo.go | ||
watch_test.go | ||
watch.go | ||
wiki_test.go | ||
wiki.go |