forgejo/models
Gusted 1b17ed668d
[TESTS] add unit test for repository collaboration (#825)
- 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
(cherry picked from commit 9de2b618a4)
(cherry picked from commit e3a6ca67e4)
2023-06-13 08:02:01 +02:00
..
actions Add user level action runners (#24995) 2023-05-31 09:39:54 +08:00
activities Use a separate admin page to show global stats, remove actions stat (#25062) 2023-06-03 22:03:41 +08:00
admin Make repo migration cancelable and fix various bugs (#24605) 2023-05-11 08:25:46 +00:00
asymkey Merge setting.InitXXX into one function with options (#24389) 2023-05-04 11:55:35 +08:00
auth Add ability to set multiple redirect URIs in OAuth application UI (#25072) 2023-06-05 15:00:12 +08:00
avatars
db Fix parallelly generating index failure with Mysql (#24567) 2023-06-05 10:33:47 +00:00
dbfs Merge setting.InitXXX into one function with options (#24389) 2023-05-04 11:55:35 +08:00
fixtures Implement actions artifacts (#22738) 2023-05-19 21:37:57 +08:00
forgejo_migrations [DB] Forgejo database migrations 2023-06-13 08:02:00 +02:00
git Fix parallelly generating index failure with Mysql (#24567) 2023-06-05 10:33:47 +00:00
issues Use RepositoryList instead of []*Repository (#25074) 2023-06-05 15:25:47 +08:00
migrations [DB] Forgejo database migrations 2023-06-13 08:02:00 +02:00
organization Use RepositoryList instead of []*Repository (#25074) 2023-06-05 15:25:47 +08:00
packages Add CRAN package registry (#22331) 2023-05-22 10:57:49 +08:00
perm Rewrite logger system (#24726) 2023-05-21 22:35:11 +00:00
project Improve GetBoards and getDefaultBoard (#22981) 2023-04-09 22:07:23 +08:00
pull
repo [TESTS] add unit test for repository collaboration (#825) 2023-06-13 08:02:01 +02:00
secret Respect original content when creating secrets (#24745) 2023-05-16 14:49:40 +08:00
shared/types Display owner of a runner as a tooltip instead of static text (#24377) 2023-05-12 08:43:27 +00:00
system
unit Rewrite logger system (#24726) 2023-05-21 22:35:11 +00:00
unittest Test query must have "order by" explicitly to avoid unstable results (#24963) 2023-05-29 03:20:57 +00:00
user Show bot label next to username when rendering autor link if the user is a bot (#24943) 2023-05-26 18:58:11 +02:00
webhook New webhook trigger for receiving Pull Request review requests (#24481) 2023-05-24 22:06:27 -04:00
error.go
fixture_generation.go
fixture_test.go
main_test.go Merge setting.InitXXX into one function with options (#24389) 2023-05-04 11:55:35 +08:00
migrate.go
migrate_test.go
org.go
org_team.go Remove org users who belong to no teams (#24247) 2023-04-24 15:52:38 -04:00
org_team_test.go
org_test.go
repo.go Implement actions artifacts (#22738) 2023-05-19 21:37:57 +08:00
repo_collaboration.go
repo_collaboration_test.go
repo_test.go
repo_transfer.go Fix unclear IsRepositoryExist logic (#24374) 2023-04-28 14:14:26 -04:00
repo_transfer_test.go