diff options
author | KN4CK3R <admin@oldschoolhack.me> | 2022-10-17 18:23:27 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-18 00:23:27 +0800 |
commit | a577214760c8f495f315fc569f476d2e72f22ebb (patch) | |
tree | 9553f3cb31e8b260ff6781821cfdce3ea192407f | |
parent | 18622a07054e853731e1af96253d1387451b51e2 (diff) | |
download | gitea-a577214760c8f495f315fc569f476d2e72f22ebb.tar.gz gitea-a577214760c8f495f315fc569f476d2e72f22ebb.zip |
Add some api integration tests (#18872)
depends on #18871
Added some api integration tests to help testing of #18798.
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
-rw-r--r-- | models/fixtures/attachment.yml | 36 | ||||
-rw-r--r-- | models/fixtures/issue.yml | 85 | ||||
-rw-r--r-- | models/fixtures/label.yml | 5 | ||||
-rw-r--r-- | models/fixtures/milestone.yml | 9 | ||||
-rw-r--r-- | models/fixtures/repository.yml | 1019 | ||||
-rw-r--r-- | models/fixtures/team.yml | 15 | ||||
-rw-r--r-- | models/fixtures/topic.yml | 12 | ||||
-rw-r--r-- | models/fixtures/user.yml | 924 | ||||
-rw-r--r-- | models/fixtures/webauthn_credential.yml | 5 | ||||
-rw-r--r-- | models/user/user_test.go | 2 | ||||
-rw-r--r-- | routers/web/user/home_test.go | 2 | ||||
-rw-r--r-- | tests/integration/api_admin_test.go | 44 | ||||
-rw-r--r-- | tests/integration/api_feed_user_test.go | 38 | ||||
-rw-r--r-- | tests/integration/api_user_follow_test.go | 111 | ||||
-rw-r--r-- | tests/integration/api_user_info_test.go | 51 | ||||
-rw-r--r-- | tests/integration/api_user_star_test.go | 78 | ||||
-rw-r--r-- | tests/integration/api_user_watch_test.go | 78 |
17 files changed, 2225 insertions, 289 deletions
diff --git a/models/fixtures/attachment.yml b/models/fixtures/attachment.yml index 8612f6ece7..9ad43fa2b7 100644 --- a/models/fixtures/attachment.yml +++ b/models/fixtures/attachment.yml @@ -3,9 +3,12 @@ uuid: a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11 repo_id: 1 issue_id: 1 + release_id: 0 + uploader_id: 0 comment_id: 0 name: attach1 download_count: 0 + size: 0 created_unix: 946684800 - @@ -13,9 +16,12 @@ uuid: a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a12 repo_id: 2 issue_id: 4 + release_id: 0 + uploader_id: 0 comment_id: 0 name: attach2 download_count: 1 + size: 0 created_unix: 946684800 - @@ -23,9 +29,12 @@ uuid: a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a13 repo_id: 1 issue_id: 2 + release_id: 0 + uploader_id: 0 comment_id: 1 name: attach1 download_count: 0 + size: 0 created_unix: 946684800 - @@ -33,9 +42,12 @@ uuid: a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a14 repo_id: 1 issue_id: 3 + release_id: 0 + uploader_id: 0 comment_id: 1 name: attach2 download_count: 1 + size: 0 created_unix: 946684800 - @@ -43,9 +55,12 @@ uuid: a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a15 repo_id: 2 issue_id: 4 + release_id: 0 + uploader_id: 0 comment_id: 0 name: attach1 download_count: 0 + size: 0 created_unix: 946684800 - @@ -53,9 +68,12 @@ uuid: a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a16 repo_id: 1 issue_id: 5 + release_id: 0 + uploader_id: 0 comment_id: 2 name: attach1 download_count: 0 + size: 0 created_unix: 946684800 - @@ -63,9 +81,12 @@ uuid: a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a17 repo_id: 1 issue_id: 5 + release_id: 0 + uploader_id: 0 comment_id: 2 name: attach1 download_count: 0 + size: 0 created_unix: 946684800 - @@ -73,34 +94,49 @@ uuid: a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a18 repo_id: 3 issue_id: 6 + release_id: 0 + uploader_id: 0 comment_id: 0 name: attach1 download_count: 0 + size: 0 created_unix: 946684800 - id: 9 uuid: a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a19 repo_id: 1 + issue_id: 0 release_id: 1 + uploader_id: 0 + comment_id: 0 name: attach1 download_count: 0 + size: 0 created_unix: 946684800 - id: 10 uuid: a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a20 repo_id: 0 # TestGetAttachment/NotLinked + issue_id: 0 + release_id: 0 uploader_id: 8 + comment_id: 0 name: attach1 download_count: 0 + size: 0 created_unix: 946684800 - id: 11 uuid: a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a21 repo_id: 40 + issue_id: 0 release_id: 2 + uploader_id: 0 + comment_id: 0 name: attach1 download_count: 0 + size: 0 created_unix: 946684800 diff --git a/models/fixtures/issue.yml b/models/fixtures/issue.yml index 39dacc92ff..4dea8add13 100644 --- a/models/fixtures/issue.yml +++ b/models/fixtures/issue.yml @@ -3,208 +3,287 @@ repo_id: 1 index: 1 poster_id: 1 + original_author_id: 0 name: issue1 content: content for the first issue + milestone_id: 0 + priority: 0 is_closed: false is_pull: false num_comments: 2 created_unix: 946684800 updated_unix: 978307200 + is_locked: false - id: 2 repo_id: 1 index: 2 poster_id: 1 + original_author_id: 0 name: issue2 content: content for the second issue milestone_id: 1 + priority: 0 is_closed: false is_pull: true + num_comments: 0 created_unix: 946684810 updated_unix: 978307190 - + is_locked: false - id: 3 repo_id: 1 index: 3 poster_id: 1 + original_author_id: 0 name: issue3 content: content for the third issue milestone_id: 3 + priority: 0 is_closed: false is_pull: true + num_comments: 0 created_unix: 946684820 updated_unix: 978307180 + is_locked: false - id: 4 repo_id: 2 index: 1 poster_id: 2 + original_author_id: 0 name: issue4 content: content for the fourth issue + milestone_id: 0 + priority: 0 is_closed: true is_pull: false + num_comments: 0 created_unix: 946684830 updated_unix: 978307200 + is_locked: false - id: 5 repo_id: 1 index: 4 poster_id: 2 + original_author_id: 0 name: issue5 content: content for the fifth issue + milestone_id: 0 + priority: 0 is_closed: true is_pull: false + num_comments: 0 created_unix: 946684840 updated_unix: 978307200 + is_locked: false - id: 6 repo_id: 3 index: 1 poster_id: 1 + original_author_id: 0 name: issue6 content: content6 + milestone_id: 0 + priority: 0 is_closed: false is_pull: false num_comments: 0 created_unix: 946684850 updated_unix: 978307200 + is_locked: false - id: 7 repo_id: 2 index: 2 poster_id: 2 + original_author_id: 0 name: issue7 content: content for the seventh issue + milestone_id: 0 + priority: 0 is_closed: false is_pull: false + num_comments: 0 created_unix: 946684830 updated_unix: 978307200 + is_locked: false - id: 8 repo_id: 10 index: 1 poster_id: 11 + original_author_id: 0 name: pr2 content: a pull request + milestone_id: 0 + priority: 0 is_closed: false is_pull: true + num_comments: 0 created_unix: 946684820 updated_unix: 978307180 + is_locked: false - id: 9 repo_id: 48 index: 1 poster_id: 11 + original_author_id: 0 name: pr1 content: a pull request + milestone_id: 0 + priority: 0 is_closed: false is_pull: true + num_comments: 0 created_unix: 946684820 updated_unix: 978307180 + is_locked: false - id: 10 repo_id: 42 index: 1 poster_id: 500 + original_author_id: 0 name: issue from deleted account content: content from deleted account + milestone_id: 0 + priority: 0 is_closed: false is_pull: false + num_comments: 0 + deadline_unix: 1019307200 created_unix: 946684830 updated_unix: 999307200 - deadline_unix: 1019307200 + is_locked: false - id: 11 repo_id: 1 index: 5 poster_id: 1 + original_author_id: 0 name: pull5 content: content for the a pull request + milestone_id: 0 + priority: 0 is_closed: false is_pull: true + num_comments: 0 created_unix: 1579194806 updated_unix: 1579194806 + is_locked: false - id: 12 repo_id: 3 index: 2 poster_id: 2 + original_author_id: 0 name: pull6 content: content for the a pull request + milestone_id: 0 + priority: 0 is_closed: false is_pull: true + num_comments: 0 created_unix: 1602935696 updated_unix: 1602935696 - + is_locked: false - id: 13 repo_id: 50 index: 1 poster_id: 2 + original_author_id: 0 name: issue in active repo content: we'll be testing github issue 13171 with this. + milestone_id: 0 + priority: 0 is_closed: false is_pull: false + num_comments: 0 created_unix: 1602935696 updated_unix: 1602935696 + is_locked: false - id: 14 repo_id: 51 index: 1 poster_id: 2 + original_author_id: 0 name: issue in archived repo content: we'll be testing github issue 13171 with this. + milestone_id: 0 + priority: 0 is_closed: false is_pull: false + num_comments: 0 created_unix: 1602935696 updated_unix: 1602935696 + is_locked: false - id: 15 repo_id: 5 index: 1 poster_id: 2 + original_author_id: 0 name: issue in repo not linked to team1 content: content + milestone_id: 0 + priority: 0 is_closed: false is_pull: false + num_comments: 0 created_unix: 1602935696 updated_unix: 1602935696 + is_locked: false - id: 16 repo_id: 32 index: 1 poster_id: 2 + original_author_id: 0 name: just a normal issue content: content + milestone_id: 0 + priority: 0 is_closed: false is_pull: false + num_comments: 0 created_unix: 1602935696 updated_unix: 1602935696 + is_locked: false - id: 17 repo_id: 32 index: 2 poster_id: 15 + original_author_id: 0 name: a issue with a assignment content: content + milestone_id: 0 + priority: 0 is_closed: false is_pull: false + num_comments: 0 created_unix: 1602935696 updated_unix: 1602935696 + is_locked: false diff --git a/models/fixtures/label.yml b/models/fixtures/label.yml index 1b7ce74681..57bf804457 100644 --- a/models/fixtures/label.yml +++ b/models/fixtures/label.yml @@ -15,10 +15,11 @@ color: '#000000' num_issues: 1 num_closed_issues: 1 + - id: 3 repo_id: 0 - org_id: 3 + org_id: 3 name: orglabel3 color: '#abcdef' num_issues: 0 @@ -32,7 +33,7 @@ color: '#000000' num_issues: 1 num_closed_issues: 0 - + - id: 5 repo_id: 10 diff --git a/models/fixtures/milestone.yml b/models/fixtures/milestone.yml index 4dd3445940..87c30cc96c 100644 --- a/models/fixtures/milestone.yml +++ b/models/fixtures/milestone.yml @@ -6,6 +6,7 @@ is_closed: false num_issues: 1 num_closed_issues: 0 + completeness: 0 deadline_unix: 253370764800 - @@ -16,6 +17,7 @@ is_closed: false num_issues: 0 num_closed_issues: 0 + completeness: 0 deadline_unix: 253370764800 - @@ -26,6 +28,7 @@ is_closed: true num_issues: 1 num_closed_issues: 0 + completeness: 0 deadline_unix: 253370764800 - @@ -36,14 +39,16 @@ is_closed: false num_issues: 0 num_closed_issues: 0 + completeness: 0 deadline_unix: 253370764800 -- +- id: 5 repo_id: 10 - name: milestone of repo 10 + name: milestone of repo 10 content: for testing with PRs is_closed: false num_issues: 0 num_closed_issues: 0 + completeness: 0 deadline_unix: 253370764800 diff --git a/models/fixtures/repository.yml b/models/fixtures/repository.yml index 82b3ed16dc..f09953be7e 100644 --- a/models/fixtures/repository.yml +++ b/models/fixtures/repository.yml @@ -4,19 +4,29 @@ owner_name: user2 lower_name: repo1 name: repo1 - is_archived: false - is_empty: false - is_private: false + num_watches: 4 + num_stars: 0 + num_forks: 0 num_issues: 2 num_closed_issues: 1 num_pulls: 3 num_closed_pulls: 0 num_milestones: 3 num_closed_milestones: 1 - num_watches: 4 num_projects: 1 num_closed_projects: 0 + is_private: false + is_empty: false + is_archived: false + is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 2 @@ -24,16 +34,29 @@ owner_name: user2 lower_name: repo2 name: repo2 - is_empty: false - is_archived: false - is_private: true + num_watches: 0 + num_stars: 1 + num_forks: 0 num_issues: 2 num_closed_issues: 1 num_pulls: 0 num_closed_pulls: 0 - num_stars: 1 - close_issues_via_commit_in_any_branch: true + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: true + is_empty: false + is_archived: false + is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: true - id: 3 @@ -41,16 +64,29 @@ owner_name: user3 lower_name: repo3 name: repo3 - is_empty: false - is_private: true + num_watches: 0 + num_stars: 0 + num_forks: 0 num_issues: 1 num_closed_issues: 0 num_pulls: 1 num_closed_pulls: 0 - num_watches: 0 + num_milestones: 0 + num_closed_milestones: 0 num_projects: 1 num_closed_projects: 0 + is_private: true + is_empty: false + is_archived: false + is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 4 @@ -58,16 +94,29 @@ owner_name: user5 lower_name: repo4 name: repo4 - is_empty: false - is_private: false + num_watches: 0 + num_stars: 1 + num_forks: 0 num_issues: 0 num_closed_issues: 0 num_pulls: 0 num_closed_pulls: 0 - num_stars: 1 + num_milestones: 0 + num_closed_milestones: 0 num_projects: 0 num_closed_projects: 1 + is_private: false + is_empty: false + is_archived: false + is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 5 @@ -75,14 +124,29 @@ owner_name: user3 lower_name: repo5 name: repo5 - is_private: true + num_watches: 0 + num_stars: 0 + num_forks: 0 num_issues: 1 num_closed_issues: 0 num_pulls: 0 num_closed_pulls: 0 - num_watches: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: true + is_empty: true + is_archived: false is_mirror: true status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 6 @@ -90,13 +154,29 @@ owner_name: user10 lower_name: repo6 name: repo6 - is_private: true + num_watches: 0 + num_stars: 0 + num_forks: 0 num_issues: 0 num_closed_issues: 0 num_pulls: 0 num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: true + is_empty: true + is_archived: false is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 7 @@ -104,13 +184,29 @@ owner_name: user10 lower_name: repo7 name: repo7 - is_private: true + num_watches: 0 + num_stars: 0 + num_forks: 0 num_issues: 0 num_closed_issues: 0 num_pulls: 0 num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: true + is_empty: true + is_archived: false is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 8 @@ -118,13 +214,29 @@ owner_name: user10 lower_name: repo8 name: repo8 - is_private: false + num_watches: 0 + num_stars: 0 + num_forks: 0 num_issues: 0 num_closed_issues: 0 num_pulls: 0 num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: false + is_empty: true + is_archived: false is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 9 @@ -132,13 +244,29 @@ owner_name: user11 lower_name: repo9 name: repo9 - is_private: false + num_watches: 0 + num_stars: 0 + num_forks: 0 num_issues: 0 num_closed_issues: 0 num_pulls: 0 num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: false + is_empty: true + is_archived: false is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 10 @@ -146,32 +274,59 @@ owner_name: user12 lower_name: repo10 name: repo10 - is_empty: false - is_private: false + num_watches: 0 + num_stars: 0 + num_forks: 1 num_issues: 0 num_closed_issues: 0 num_pulls: 1 num_closed_pulls: 0 num_milestones: 1 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: false + is_empty: false + is_archived: false is_mirror: false - num_forks: 1 status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 11 - fork_id: 10 owner_id: 13 owner_name: user13 lower_name: repo11 name: repo11 - is_empty: false - is_private: false + num_watches: 0 + num_stars: 0 + num_forks: 0 num_issues: 0 num_closed_issues: 0 num_pulls: 0 num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: false + is_empty: false + is_archived: false is_mirror: false status: 0 + is_fork: false + fork_id: 10 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 12 @@ -179,13 +334,29 @@ owner_name: user14 lower_name: test_repo_12 name: test_repo_12 - is_private: false + num_watches: 0 + num_stars: 0 + num_forks: 0 num_issues: 0 num_closed_issues: 0 num_pulls: 0 num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: false + is_empty: true + is_archived: false is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 13 @@ -193,13 +364,29 @@ owner_name: user14 lower_name: test_repo_13 name: test_repo_13 - is_private: true + num_watches: 0 + num_stars: 0 + num_forks: 0 num_issues: 0 num_closed_issues: 0 num_pulls: 0 num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: true + is_empty: true + is_archived: false is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 14 @@ -208,13 +395,29 @@ lower_name: test_repo_14 name: test_repo_14 description: test_description_14 - is_private: false + num_watches: 0 + num_stars: 0 + num_forks: 0 num_issues: 0 num_closed_issues: 0 num_pulls: 0 num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: false + is_empty: true + is_archived: false is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 15 @@ -222,9 +425,29 @@ owner_name: user2 lower_name: repo15 name: repo15 - is_empty: false + num_watches: 0 + num_stars: 0 + num_forks: 0 + num_issues: 0 + num_closed_issues: 0 + num_pulls: 0 + num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 is_private: true + is_empty: false + is_archived: false + is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 16 @@ -232,14 +455,29 @@ owner_name: user2 lower_name: repo16 name: repo16 - is_empty: false - is_private: true + num_watches: 0 + num_stars: 0 + num_forks: 0 num_issues: 0 num_closed_issues: 0 num_pulls: 0 num_closed_pulls: 0 - num_watches: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: true + is_empty: false + is_archived: false + is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 17 @@ -247,15 +485,29 @@ owner_name: user15 lower_name: big_test_public_1 name: big_test_public_1 - is_private: false + num_watches: 0 + num_stars: 0 + num_forks: 0 num_issues: 0 num_closed_issues: 0 num_pulls: 0 num_closed_pulls: 0 - num_watches: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: false + is_empty: true + is_archived: false is_mirror: false - is_fork: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 18 @@ -263,14 +515,29 @@ owner_name: user15 lower_name: big_test_public_2 name: big_test_public_2 - is_private: false + num_watches: 0 + num_stars: 0 + num_forks: 0 num_issues: 0 num_closed_issues: 0 num_pulls: 0 num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: false + is_empty: true + is_archived: false is_mirror: false - is_fork: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 19 @@ -278,14 +545,29 @@ owner_name: user15 lower_name: big_test_private_1 name: big_test_private_1 - is_private: true + num_watches: 0 + num_stars: 0 + num_forks: 0 num_issues: 0 num_closed_issues: 0 num_pulls: 0 num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: true + is_empty: true + is_archived: false is_mirror: false - is_fork: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 20 @@ -293,14 +575,29 @@ owner_name: user15 lower_name: big_test_private_2 name: big_test_private_2 - is_private: true + num_watches: 0 + num_stars: 0 + num_forks: 0 num_issues: 0 num_closed_issues: 0 num_pulls: 0 num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: true + is_empty: true + is_archived: false is_mirror: false - is_fork: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 21 @@ -308,14 +605,29 @@ owner_name: user16 lower_name: big_test_public_3 name: big_test_public_3 - is_private: false + num_watches: 0 + num_stars: 0 + num_forks: 0 num_issues: 0 num_closed_issues: 0 num_pulls: 0 num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: false + is_empty: true + is_archived: false is_mirror: false - is_fork: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 22 @@ -323,14 +635,29 @@ owner_name: user16 lower_name: big_test_private_3 name: big_test_private_3 - is_private: true + num_watches: 0 + num_stars: 0 + num_forks: 0 num_issues: 0 num_closed_issues: 0 num_pulls: 0 num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: true + is_empty: true + is_archived: false is_mirror: false - is_fork: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 23 @@ -338,14 +665,29 @@ owner_name: user17 lower_name: big_test_public_4 name: big_test_public_4 - is_private: false + num_watches: 0 + num_stars: 0 + num_forks: 0 num_issues: 0 num_closed_issues: 0 num_pulls: 0 num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: false + is_empty: true + is_archived: false is_mirror: false - is_fork: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 24 @@ -353,14 +695,29 @@ owner_name: user17 lower_name: big_test_private_4 name: big_test_private_4 - is_private: true + num_watches: 0 + num_stars: 0 + num_forks: 0 num_issues: 0 num_closed_issues: 0 num_pulls: 0 num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: true + is_empty: true + is_archived: false is_mirror: false - is_fork: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 25 @@ -368,15 +725,29 @@ owner_name: user20 lower_name: big_test_public_mirror_5 name: big_test_public_mirror_5 - is_private: false + num_watches: 0 + num_stars: 0 + num_forks: 0 num_issues: 0 num_closed_issues: 0 num_pulls: 0 num_closed_pulls: 0 - num_watches: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: false + is_empty: true + is_archived: false is_mirror: true - is_fork: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 26 @@ -384,15 +755,29 @@ owner_name: user20 lower_name: big_test_private_mirror_5 name: big_test_private_mirror_5 - is_private: true + num_watches: 0 + num_stars: 0 + num_forks: 0 num_issues: 0 num_closed_issues: 0 num_pulls: 0 num_closed_pulls: 0 - num_watches: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: true + is_empty: true + is_archived: false is_mirror: true - is_fork: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 27 @@ -400,16 +785,29 @@ owner_name: user19 lower_name: big_test_public_mirror_6 name: big_test_public_mirror_6 - is_private: false + num_watches: 0 + num_stars: 0 + num_forks: 1 num_issues: 0 num_closed_issues: 0 num_pulls: 0 num_closed_pulls: 0 - num_watches: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: false + is_empty: true + is_archived: false is_mirror: true - num_forks: 1 - is_fork: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 28 @@ -417,48 +815,89 @@ owner_name: user19 lower_name: big_test_private_mirror_6 name: big_test_private_mirror_6 - is_private: true + num_watches: 0 + num_stars: 0 + num_forks: 1 num_issues: 0 num_closed_issues: 0 num_pulls: 0 num_closed_pulls: 0 - num_watches: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: true + is_empty: true + is_archived: false is_mirror: true - num_forks: 1 - is_fork: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 29 - fork_id: 27 owner_id: 20 owner_name: user20 lower_name: big_test_public_fork_7 name: big_test_public_fork_7 - is_private: false + num_watches: 0 + num_stars: 0 + num_forks: 0 num_issues: 0 num_closed_issues: 0 num_pulls: 0 num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: false + is_empty: true + is_archived: false is_mirror: false - is_fork: true status: 0 + is_fork: true + fork_id: 27 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 30 - fork_id: 28 owner_id: 20 owner_name: user20 lower_name: big_test_private_fork_7 name: big_test_private_fork_7 - is_private: true + num_watches: 0 + num_stars: 0 + num_forks: 0 num_issues: 0 num_closed_issues: 0 num_pulls: 0 num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: true + is_empty: true + is_archived: false is_mirror: false - is_fork: true status: 0 + is_fork: true + fork_id: 28 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 31 @@ -466,13 +905,29 @@ owner_name: user2 lower_name: repo20 name: repo20 - is_empty: false - is_private: true + num_watches: 0 num_stars: 0 num_forks: 0 num_issues: 0 + num_closed_issues: 0 + num_pulls: 0 + num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: true + is_empty: false + is_archived: false is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 32 # org public repo @@ -480,12 +935,29 @@ owner_name: user3 lower_name: repo21 name: repo21 - is_private: false + num_watches: 0 num_stars: 0 num_forks: 0 num_issues: 2 + num_closed_issues: 0 + num_pulls: 0 + num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: false + is_empty: true + is_archived: false is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 33 @@ -493,9 +965,29 @@ owner_name: user2 lower_name: utf8 name: utf8 - is_empty: false + num_watches: 0 + num_stars: 0 + num_forks: 0 + num_issues: 0 + num_closed_issues: 0 + num_pulls: 0 + num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 is_private: false + is_empty: false + is_archived: false + is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 34 @@ -503,12 +995,29 @@ owner_name: user21 lower_name: golang name: golang - is_private: false + num_watches: 0 num_stars: 0 num_forks: 0 num_issues: 0 + num_closed_issues: 0 + num_pulls: 0 + num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: false + is_empty: true + is_archived: false is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 35 @@ -516,12 +1025,29 @@ owner_name: user21 lower_name: graphql name: graphql - is_private: false + num_watches: 0 num_stars: 0 num_forks: 0 num_issues: 0 + num_closed_issues: 0 + num_pulls: 0 + num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: false + is_empty: true + is_archived: false is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 36 @@ -529,13 +1055,29 @@ owner_name: user2 lower_name: commits_search_test name: commits_search_test - is_empty: false - is_private: false + num_watches: 0 num_stars: 0 num_forks: 0 num_issues: 0 + num_closed_issues: 0 + num_pulls: 0 + num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: false + is_empty: false + is_archived: false is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 37 @@ -543,13 +1085,29 @@ owner_name: user2 lower_name: git_hooks_test name: git_hooks_test - is_empty: false - is_private: false + num_watches: 0 num_stars: 0 num_forks: 0 num_issues: 0 + num_closed_issues: 0 + num_pulls: 0 + num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: false + is_empty: false + is_archived: false is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 38 @@ -557,13 +1115,29 @@ owner_name: limited_org lower_name: public_repo_on_limited_org name: public_repo_on_limited_org - is_empty: false - is_private: false + num_watches: 0 num_stars: 0 num_forks: 0 num_issues: 0 + num_closed_issues: 0 + num_pulls: 0 + num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: false + is_empty: false + is_archived: false is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 39 @@ -571,13 +1145,29 @@ owner_name: limited_org lower_name: private_repo_on_limited_org name: private_repo_on_limited_org - is_empty: false - is_private: true + num_watches: 0 num_stars: 0 num_forks: 0 num_issues: 0 + num_closed_issues: 0 + num_pulls: 0 + num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: true + is_empty: false + is_archived: false is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 40 @@ -585,13 +1175,29 @@ owner_name: privated_org lower_name: public_repo_on_private_org name: public_repo_on_private_org - is_empty: false - is_private: false + num_watches: 0 num_stars: 0 num_forks: 0 num_issues: 0 + num_closed_issues: 0 + num_pulls: 0 + num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: false + is_empty: false + is_archived: false is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 41 @@ -599,12 +1205,29 @@ owner_name: privated_org lower_name: private_repo_on_private_org name: private_repo_on_private_org - is_empty: false - is_private: true + num_watches: 0 num_stars: 0 num_forks: 0 num_issues: 0 + num_closed_issues: 0 + num_pulls: 0 + num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: true + is_empty: false + is_archived: false is_mirror: false + status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 42 @@ -612,14 +1235,29 @@ owner_name: user2 lower_name: glob name: glob - is_empty: false - is_private: false + num_watches: 0 num_stars: 0 num_forks: 0 num_issues: 1 + num_closed_issues: 0 + num_pulls: 0 + num_closed_pulls: 0 num_milestones: 1 - is_mirror: + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: false + is_empty: false is_archived: false + is_mirror: false + status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 43 @@ -627,12 +1265,29 @@ owner_name: org26 lower_name: repo26 name: repo26 - is_private: true + num_watches: 0 num_stars: 0 num_forks: 0 num_issues: 0 + num_closed_issues: 0 + num_pulls: 0 + num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: true + is_empty: true + is_archived: false is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 44 @@ -640,14 +1295,29 @@ owner_name: user27 lower_name: template1 name: template1 - is_empty: false - is_private: false - is_template: true + num_watches: 0 num_stars: 0 num_forks: 0 num_issues: 0 + num_closed_issues: 0 + num_pulls: 0 + num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: false + is_empty: false + is_archived: false is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: true + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 45 @@ -655,13 +1325,29 @@ owner_name: user27 lower_name: template2 name: template2 - is_private: false - is_template: true + num_watches: 0 num_stars: 0 num_forks: 0 num_issues: 0 + num_closed_issues: 0 + num_pulls: 0 + num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: false + is_empty: true + is_archived: false is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: true + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 46 @@ -669,13 +1355,29 @@ owner_name: org26 lower_name: repo_external_tracker name: repo_external_tracker - is_empty: false - is_private: false + num_watches: 0 num_stars: 0 num_forks: 0 num_issues: 0 + num_closed_issues: 0 + num_pulls: 0 + num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: false + is_empty: false + is_archived: false is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 47 @@ -683,13 +1385,29 @@ owner_name: org26 lower_name: repo_external_tracker_numeric name: repo_external_tracker_numeric - is_empty: false - is_private: false + num_watches: 0 num_stars: 0 num_forks: 0 num_issues: 0 + num_closed_issues: 0 + num_pulls: 0 + num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: false + is_empty: false + is_archived: false is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 48 @@ -697,14 +1415,29 @@ owner_name: org26 lower_name: repo_external_tracker_alpha name: repo_external_tracker_alpha - is_empty: false - is_private: false + num_watches: 0 num_stars: 0 num_forks: 0 num_issues: 0 + num_closed_issues: 0 num_pulls: 1 + num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: false + is_empty: false + is_archived: false is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 49 @@ -712,13 +1445,29 @@ owner_name: user27 lower_name: repo49 name: repo49 - is_empty: false - is_private: false + num_watches: 0 num_stars: 0 num_forks: 0 num_issues: 0 + num_closed_issues: 0 + num_pulls: 0 + num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: false + is_empty: false + is_archived: false is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 50 @@ -726,19 +1475,29 @@ owner_name: user30 lower_name: repo50 name: repo50 - is_archived: false - is_empty: false - is_private: false + num_watches: 0 + num_stars: 0 + num_forks: 0 num_issues: 1 num_closed_issues: 0 num_pulls: 0 num_closed_pulls: 0 num_milestones: 0 num_closed_milestones: 0 - num_watches: 0 num_projects: 0 num_closed_projects: 0 + is_private: false + is_empty: false + is_archived: false + is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 51 @@ -746,19 +1505,29 @@ owner_name: user30 lower_name: repo51 name: repo51 - is_archived: true - is_empty: false - is_private: false + num_watches: 0 + num_stars: 0 + num_forks: 0 num_issues: 1 num_closed_issues: 0 num_pulls: 0 num_closed_pulls: 0 num_milestones: 0 num_closed_milestones: 0 - num_watches: 0 num_projects: 0 num_closed_projects: 0 + is_private: false + is_empty: false + is_archived: true + is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 52 @@ -766,6 +1535,26 @@ owner_name: user30 lower_name: empty name: empty - is_empty: true + num_watches: 0 + num_stars: 0 + num_forks: 0 + num_issues: 0 + num_closed_issues: 0 + num_pulls: 0 + num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 is_private: true + is_empty: true + is_archived: false + is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false diff --git a/models/fixtures/team.yml b/models/fixtures/team.yml index 880f49dc90..ea47a33f1c 100644 --- a/models/fixtures/team.yml +++ b/models/fixtures/team.yml @@ -6,6 +6,7 @@ authorize: 4 # owner num_repos: 3 num_members: 1 + includes_all_repositories: false can_create_org_repo: true - @@ -16,6 +17,7 @@ authorize: 2 # write num_repos: 1 num_members: 2 + includes_all_repositories: false can_create_org_repo: false - @@ -26,6 +28,7 @@ authorize: 4 # owner num_repos: 0 num_members: 1 + includes_all_repositories: false can_create_org_repo: true - @@ -36,6 +39,7 @@ authorize: 4 # owner num_repos: 0 num_members: 1 + includes_all_repositories: false can_create_org_repo: true - @@ -46,6 +50,7 @@ authorize: 4 # owner num_repos: 2 num_members: 2 + includes_all_repositories: false can_create_org_repo: true - @@ -56,6 +61,7 @@ authorize: 4 # owner num_repos: 2 num_members: 2 + includes_all_repositories: false can_create_org_repo: true - @@ -66,6 +72,7 @@ authorize: 2 # write num_repos: 1 num_members: 1 + includes_all_repositories: false can_create_org_repo: false - @@ -76,6 +83,7 @@ authorize: 2 # write num_repos: 1 num_members: 1 + includes_all_repositories: false can_create_org_repo: false - @@ -86,6 +94,7 @@ authorize: 1 # read num_repos: 1 num_members: 2 + includes_all_repositories: false can_create_org_repo: false - @@ -93,9 +102,10 @@ org_id: 25 lower_name: notowners name: NotOwners - authorize: 1 # owner + authorize: 1 # read num_repos: 0 num_members: 1 + includes_all_repositories: false can_create_org_repo: false - @@ -106,6 +116,7 @@ authorize: 1 # read num_repos: 0 num_members: 0 + includes_all_repositories: false can_create_org_repo: false - @@ -116,6 +127,7 @@ authorize: 3 # admin num_repos: 0 num_members: 1 + includes_all_repositories: false can_create_org_repo: true - @@ -126,4 +138,5 @@ authorize: 3 # admin num_repos: 0 num_members: 1 + includes_all_repositories: false can_create_org_repo: false diff --git a/models/fixtures/topic.yml b/models/fixtures/topic.yml index 6cd0b37fa1..055addf510 100644 --- a/models/fixtures/topic.yml +++ b/models/fixtures/topic.yml @@ -8,18 +8,22 @@ name: database repo_count: 1 -- id: 3 +- + id: 3 name: SQL repo_count: 1 -- id: 4 +- + id: 4 name: graphql repo_count: 1 -- id: 5 +- + id: 5 name: topicname1 repo_count: 1 -- id: 6 +- + id: 6 name: topicname2 repo_count: 2 diff --git a/models/fixtures/user.yml b/models/fixtures/user.yml index 790156189a..0e3348e146 100644 --- a/models/fixtures/user.yml +++ b/models/fixtures/user.yml @@ -4,611 +4,1219 @@ id: 1 lower_name: user1 name: user1 - login_name: user1 full_name: User One email: user1@example.com + keep_email_private: false email_notifications_preference: enabled + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 0 # individual + must_change_password: false + login_source: 0 + login_name: user1 + type: 0 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: true is_admin: true + is_restricted: false + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: false avatar: avatar1 avatar_email: user1@example.com + use_custom_avatar: false + num_followers: 0 + num_following: 0 + num_stars: 0 num_repos: 0 - is_active: true + num_teams: 0 + num_members: 0 + visibility: 0 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false - id: 2 lower_name: user2 name: user2 - login_name: user2 - full_name: " < U<se>r Tw<o > >< " + full_name: ' < U<se>r Tw<o > >< ' email: user2@example.com keep_email_private: true email_notifications_preference: enabled + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 0 # individual + must_change_password: false + login_source: 0 + login_name: user2 + type: 0 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: true is_admin: false + is_restricted: false + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: false avatar: avatar2 avatar_email: user2@example.com - num_repos: 9 - num_stars: 2 + use_custom_avatar: false num_followers: 2 num_following: 1 - is_active: true + num_stars: 2 + num_repos: 9 + num_teams: 0 + num_members: 0 + visibility: 0 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false - id: 3 lower_name: user3 name: user3 - login_name: user3 - full_name: " <<<< >> >> > >> > >>> >> " + full_name: ' <<<< >> >> > >> > >>> >> ' email: user3@example.com + keep_email_private: false email_notifications_preference: onmention + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 1 # organization + must_change_password: false + login_source: 0 + login_name: user3 + type: 1 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: false is_admin: false + is_restricted: false + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: false avatar: avatar3 avatar_email: user3@example.com + use_custom_avatar: false + num_followers: 0 + num_following: 0 + num_stars: 0 num_repos: 3 - num_members: 3 num_teams: 4 + num_members: 3 + visibility: 0 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false - id: 4 lower_name: user4 name: user4 - login_name: user4 - full_name: " " + full_name: ' ' email: user4@example.com + keep_email_private: false email_notifications_preference: onmention + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 0 # individual + must_change_password: false + login_source: 0 + login_name: user4 + type: 0 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: true is_admin: false + is_restricted: false + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: false avatar: avatar4 avatar_email: user4@example.com - num_repos: 0 + use_custom_avatar: false + num_followers: 0 num_following: 1 - is_active: true + num_stars: 0 + num_repos: 0 + num_teams: 0 + num_members: 0 + visibility: 0 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false - id: 5 lower_name: user5 name: user5 - login_name: user5 full_name: User Five email: user5@example.com + keep_email_private: false email_notifications_preference: enabled + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 0 # individual + must_change_password: false + login_source: 0 + login_name: user5 + type: 0 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: true is_admin: false + is_restricted: false + allow_git_hook: false + allow_import_local: false + allow_create_organization: false + prohibit_login: false avatar: avatar5 avatar_email: user5@example.com - num_repos: 1 - allow_create_organization: false - is_active: true + use_custom_avatar: false + num_followers: 0 num_following: 0 + num_stars: 0 + num_repos: 1 + num_teams: 0 + num_members: 0 + visibility: 0 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false - id: 6 lower_name: user6 name: user6 - login_name: user6 full_name: User Six email: user6@example.com + keep_email_private: false email_notifications_preference: enabled + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 1 # organization + must_change_password: false + login_source: 0 + login_name: user6 + type: 1 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: false is_admin: false + is_restricted: false + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: false avatar: avatar6 avatar_email: user6@example.com + use_custom_avatar: false + num_followers: 0 + num_following: 0 + num_stars: 0 num_repos: 0 - num_members: 2 num_teams: 2 + num_members: 2 + visibility: 0 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false - id: 7 lower_name: user7 name: user7 - login_name: user7 full_name: User Seven email: user7@example.com + keep_email_private: false email_notifications_preference: disabled + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 1 # organization + must_change_password: false + login_source: 0 + login_name: user7 + type: 1 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: false is_admin: false + is_restricted: false + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: false avatar: avatar7 avatar_email: user7@example.com + use_custom_avatar: false + num_followers: 0 + num_following: 0 + num_stars: 0 num_repos: 0 - num_members: 1 num_teams: 1 + num_members: 1 + visibility: 0 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false - id: 8 lower_name: user8 name: user8 - login_name: user8 full_name: User Eight email: user8@example.com + keep_email_private: false email_notifications_preference: enabled + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 0 # individual + must_change_password: false + login_source: 0 + login_name: user8 + type: 0 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: true is_admin: false + is_restricted: false + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: false avatar: avatar8 avatar_email: user8@example.com - num_repos: 0 - is_active: true + use_custom_avatar: false num_followers: 1 num_following: 1 + num_stars: 0 + num_repos: 0 + num_teams: 0 + num_members: 0 + visibility: 0 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false - id: 9 lower_name: user9 name: user9 - login_name: user9 full_name: User Nine email: user9@example.com + keep_email_private: false email_notifications_preference: onmention + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 0 # individual + must_change_password: false + login_source: 0 + login_name: user9 + type: 0 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: false is_admin: false + is_restricted: false + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: false avatar: avatar9 avatar_email: user9@example.com + use_custom_avatar: false + num_followers: 0 + num_following: 0 + num_stars: 0 num_repos: 0 - is_active: false + num_teams: 0 + num_members: 0 + visibility: 0 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false - id: 10 lower_name: user10 name: user10 - login_name: user10 full_name: User Ten email: user10@example.com + keep_email_private: false + email_notifications_preference: enabled + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 0 # individual + must_change_password: false + login_source: 0 + login_name: user10 + type: 0 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: true is_admin: false + is_restricted: false + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: false avatar: avatar10 avatar_email: user10@example.com + use_custom_avatar: false + num_followers: 0 + num_following: 0 + num_stars: 0 num_repos: 3 - is_active: true + num_teams: 0 + num_members: 0 + visibility: 0 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false - id: 11 lower_name: user11 name: user11 - login_name: user11 full_name: User Eleven email: user11@example.com + keep_email_private: false + email_notifications_preference: enabled + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 0 # individual + must_change_password: false + login_source: 0 + login_name: user11 + type: 0 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: true is_admin: false + is_restricted: false + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: false avatar: avatar11 avatar_email: user11@example.com + use_custom_avatar: false + num_followers: 0 + num_following: 0 + num_stars: 0 num_repos: 1 - is_active: true + num_teams: 0 + num_members: 0 + visibility: 0 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false - id: 12 lower_name: user12 name: user12 - login_name: user12 full_name: User 12 email: user12@example.com + keep_email_private: false + email_notifications_preference: enabled + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 0 # individual + must_change_password: false + login_source: 0 + login_name: user12 + type: 0 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: true is_admin: false + is_restricted: false + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: false avatar: avatar12 avatar_email: user12@example.com + use_custom_avatar: false + num_followers: 0 + num_following: 0 + num_stars: 0 num_repos: 1 - is_active: true + num_teams: 0 + num_members: 0 + visibility: 0 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false - id: 13 lower_name: user13 name: user13 - login_name: user13 full_name: User 13 email: user13@example.com + keep_email_private: false + email_notifications_preference: enabled + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 0 # individual + must_change_password: false + login_source: 0 + login_name: user13 + type: 0 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: true is_admin: false + is_restricted: false + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: false avatar: avatar13 avatar_email: user13@example.com + use_custom_avatar: false + num_followers: 0 + num_following: 0 + num_stars: 0 num_repos: 1 - is_active: true + num_teams: 0 + num_members: 0 + visibility: 0 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false - id: 14 lower_name: user14 name: user14 - login_name: user14 full_name: User 14 email: user14@example.com + keep_email_private: false + email_notifications_preference: enabled + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 0 # individual + must_change_password: false + login_source: 0 + login_name: user14 + type: 0 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: true is_admin: false + is_restricted: false + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: false avatar: avatar14 avatar_email: user13@example.com + use_custom_avatar: false + num_followers: 0 + num_following: 0 + num_stars: 0 num_repos: 3 - is_active: true + num_teams: 0 + num_members: 0 + visibility: 0 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false - id: 15 lower_name: user15 name: user15 - login_name: user15 full_name: User 15 email: user15@example.com + keep_email_private: false + email_notifications_preference: enabled + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 0 # individual + must_change_password: false + login_source: 0 + login_name: user15 + type: 0 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: true is_admin: false + is_restricted: false + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: false avatar: avatar15 avatar_email: user15@example.com + use_custom_avatar: false + num_followers: 0 + num_following: 0 + num_stars: 0 num_repos: 4 - is_active: true + num_teams: 0 + num_members: 0 + visibility: 0 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false - id: 16 lower_name: user16 name: user16 - login_name: user16 full_name: User 16 email: user16@example.com + keep_email_private: false + email_notifications_preference: enabled + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 0 # individual + must_change_password: false + login_source: 0 + login_name: user16 + type: 0 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: true is_admin: false + is_restricted: false + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: false avatar: avatar16 avatar_email: user16@example.com + use_custom_avatar: false + num_followers: 0 + num_following: 0 + num_stars: 0 num_repos: 2 - is_active: true + num_teams: 0 + num_members: 0 + visibility: 0 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false - id: 17 lower_name: user17 name: user17 - login_name: user17 full_name: User 17 email: user17@example.com + keep_email_private: false + email_notifications_preference: enabled + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 1 # organization + must_change_password: false + login_source: 0 + login_name: user17 + type: 1 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: true is_admin: false + is_restricted: false + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: false avatar: avatar17 avatar_email: user17@example.com + use_custom_avatar: false + num_followers: 0 + num_following: 0 + num_stars: 0 num_repos: 2 - is_active: true - num_members: 4 num_teams: 3 + num_members: 4 + visibility: 0 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false - id: 18 lower_name: user18 name: user18 - login_name: user18 full_name: User 18 email: user18@example.com + keep_email_private: false + email_notifications_preference: enabled + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 0 # individual + must_change_password: false + login_source: 0 + login_name: user18 + type: 0 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: true is_admin: false + is_restricted: false + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: false avatar: avatar18 avatar_email: user18@example.com + use_custom_avatar: false + num_followers: 0 + num_following: 0 + num_stars: 0 num_repos: 0 - is_active: true + num_teams: 0 + num_members: 0 + visibility: 0 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false - id: 19 lower_name: user19 name: user19 - login_name: user19 full_name: User 19 email: user19@example.com + keep_email_private: false + email_notifications_preference: enabled + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 1 # organization + must_change_password: false + login_source: 0 + login_name: user19 + type: 1 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: true is_admin: false + is_restricted: false + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: false avatar: avatar19 avatar_email: user19@example.com + use_custom_avatar: false + num_followers: 0 + num_following: 0 + num_stars: 0 num_repos: 2 - is_active: true - num_members: 2 num_teams: 1 + num_members: 2 + visibility: 0 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false - id: 20 lower_name: user20 name: user20 - login_name: user20 full_name: User 20 email: user20@example.com + keep_email_private: false + email_notifications_preference: enabled + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 0 # individual + must_change_password: false + login_source: 0 + login_name: user20 + type: 0 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: true is_admin: false + is_restricted: false + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: false avatar: avatar20 avatar_email: user20@example.com + use_custom_avatar: false + num_followers: 0 + num_following: 0 + num_stars: 0 num_repos: 4 - is_active: true + num_teams: 0 + num_members: 0 + visibility: 0 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false - id: 21 lower_name: user21 name: user21 - login_name: user21 full_name: User 21 email: user21@example.com + keep_email_private: false + email_notifications_preference: enabled + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 0 # individual + must_change_password: false + login_source: 0 + login_name: user21 + type: 0 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: true is_admin: false + is_restricted: false + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: false avatar: avatar21 avatar_email: user21@example.com + use_custom_avatar: false + num_followers: 0 + num_following: 0 + num_stars: 0 num_repos: 2 - is_active: true + num_teams: 0 + num_members: 0 + visibility: 0 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false - id: 22 lower_name: limited_org name: limited_org - login_name: limited_org full_name: Limited Org email: limited_org@example.com + keep_email_private: false + email_notifications_preference: enabled + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 1 # organization + must_change_password: false + login_source: 0 + login_name: limited_org + type: 1 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: true is_admin: false + is_restricted: false + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: false avatar: avatar22 avatar_email: limited_org@example.com + use_custom_avatar: false + num_followers: 0 + num_following: 0 + num_stars: 0 num_repos: 2 - is_active: true - num_members: 0 num_teams: 0 + num_members: 0 visibility: 1 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false - id: 23 lower_name: privated_org name: privated_org - login_name: privated_org full_name: Privated Org email: privated_org@example.com + keep_email_private: false + email_notifications_preference: enabled + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 1 # organization + must_change_password: false + login_source: 0 + login_name: privated_org + type: 1 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: true is_admin: false + is_restricted: false + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: false avatar: avatar23 avatar_email: privated_org@example.com + use_custom_avatar: false + num_followers: 0 + num_following: 0 + num_stars: 0 num_repos: 2 - is_active: true - num_members: 0 num_teams: 0 + num_members: 0 visibility: 2 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false - id: 24 lower_name: user24 name: user24 - login_name: user24 - full_name: "user24" + full_name: user24 email: user24@example.com keep_email_private: true + email_notifications_preference: enabled + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 0 # individual + must_change_password: false + login_source: 0 + login_name: user24 + type: 0 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: true is_admin: false + is_restricted: false + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: false avatar: avatar24 avatar_email: user24@example.com - num_repos: 0 - num_stars: 0 + use_custom_avatar: false num_followers: 0 num_following: 0 - is_active: true + num_stars: 0 + num_repos: 0 + num_teams: 0 + num_members: 0 + visibility: 0 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false - id: 25 lower_name: org25 name: org25 - login_name: org25 - full_name: "org25" + full_name: org25 email: org25@example.com + keep_email_private: false + email_notifications_preference: enabled + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 1 # organization + must_change_password: false + login_source: 0 + login_name: org25 + type: 1 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: false is_admin: false + is_restricted: false + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: false avatar: avatar25 avatar_email: org25@example.com + use_custom_avatar: false + num_followers: 0 + num_following: 0 + num_stars: 0 num_repos: 0 - num_members: 1 num_teams: 1 + num_members: 1 + visibility: 0 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false - id: 26 lower_name: org26 name: org26 - login_name: org26 - full_name: "Org26" + full_name: Org26 email: org26@example.com + keep_email_private: false email_notifications_preference: onmention + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 1 # organization + must_change_password: false + login_source: 0 + login_name: org26 + type: 1 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: false is_admin: false + is_restricted: false + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: false avatar: avatar26 avatar_email: org26@example.com + use_custom_avatar: false + num_followers: 0 + num_following: 0 + num_stars: 0 num_repos: 4 - num_members: 0 num_teams: 1 + num_members: 0 + visibility: 0 repo_admin_change_team_access: true + theme: "" + keep_activity_private: false - id: 27 lower_name: user27 name: user27 - login_name: user27 full_name: User Twenty-Seven email: user27@example.com + keep_email_private: false email_notifications_preference: enabled + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 0 # individual + must_change_password: false + login_source: 0 + login_name: user27 + type: 0 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: true is_admin: false + is_restricted: false + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: false avatar: avatar27 avatar_email: user27@example.com + use_custom_avatar: false + num_followers: 0 + num_following: 0 + num_stars: 0 num_repos: 3 + num_teams: 0 + num_members: 0 + visibility: 0 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false - id: 28 lower_name: user28 name: user28 - login_name: user28 - full_name: "user27" + full_name: user27 email: user28@example.com keep_email_private: true + email_notifications_preference: enabled + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 0 # individual + must_change_password: false + login_source: 0 + login_name: user28 + type: 0 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: true is_admin: false + is_restricted: false + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: false avatar: avatar28 avatar_email: user28@example.com - num_repos: 0 - num_stars: 0 + use_custom_avatar: false num_followers: 0 num_following: 0 - is_active: true + num_stars: 0 + num_repos: 0 + num_teams: 0 + num_members: 0 + visibility: 0 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false - id: 29 lower_name: user29 name: user29 - login_name: user29 full_name: User 29 email: user29@example.com + keep_email_private: false + email_notifications_preference: enabled + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 0 # individual + must_change_password: false + login_source: 0 + login_name: user29 + type: 0 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: true is_admin: false is_restricted: true + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: false avatar: avatar29 avatar_email: user29@example.com + use_custom_avatar: false + num_followers: 0 + num_following: 0 + num_stars: 0 num_repos: 0 - is_active: true + num_teams: 0 + num_members: 0 + visibility: 0 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false - id: 30 lower_name: user30 name: user30 - login_name: user30 full_name: User Thirty email: user30@example.com + keep_email_private: false + email_notifications_preference: enabled + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 0 # individual + must_change_password: false + login_source: 0 + login_name: user30 + type: 0 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: true is_admin: false is_restricted: true + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: true avatar: avatar29 avatar_email: user30@example.com + use_custom_avatar: false + num_followers: 0 + num_following: 0 + num_stars: 0 num_repos: 3 - is_active: true - prohibit_login: true + num_teams: 0 + num_members: 0 + visibility: 0 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false - id: 31 lower_name: user31 name: user31 - login_name: user31 - full_name: "user31" + full_name: user31 email: user31@example.com + keep_email_private: false + email_notifications_preference: enabled + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 0 # individual + must_change_password: false + login_source: 0 + login_name: user31 + type: 0 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: true is_admin: false - visibility: 2 + is_restricted: false + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: false avatar: avatar31 avatar_email: user31@example.com - num_repos: 0 + use_custom_avatar: false num_followers: 0 num_following: 1 - is_active: true + num_stars: 0 + num_repos: 0 + num_teams: 0 + num_members: 0 + visibility: 2 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false - id: 32 lower_name: user32 name: user32 - login_name: user32 full_name: User 32 (U2F test) email: user32@example.com - passwd: 7d93daa0d1e6f2305cc8fa496847d61dc7320bb16262f9c55dd753480207234cdd96a93194e408341971742f4701772a025a # password - type: 0 # individual + keep_email_private: false + email_notifications_preference: enabled + passwd: 7d93daa0d1e6f2305cc8fa496847d61dc7320bb16262f9c55dd753480207234cdd96a93194e408341971742f4701772a025a + passwd_hash_algo: argon2 + must_change_password: false + login_source: 0 + login_name: user32 + type: 0 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: true is_admin: false is_restricted: false + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: false avatar: avatar32 avatar_email: user30@example.com + use_custom_avatar: false + num_followers: 0 + num_following: 0 + num_stars: 0 num_repos: 0 - is_active: true + num_teams: 0 + num_members: 0 + visibility: 0 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false - id: 33 lower_name: user33 name: user33 - login_name: user33 full_name: User 33 (Limited Visibility) email: user33@example.com + keep_email_private: false + email_notifications_preference: enabled + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 0 # individual + must_change_password: false + login_source: 0 + login_name: user33 + type: 0 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: true is_admin: false - visibility: 1 + is_restricted: false + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: false avatar: avatar33 avatar_email: user33@example.com - num_repos: 0 + use_custom_avatar: false num_followers: 1 num_following: 0 - is_active: true + num_stars: 0 + num_repos: 0 + num_teams: 0 + num_members: 0 + visibility: 1 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false diff --git a/models/fixtures/webauthn_credential.yml b/models/fixtures/webauthn_credential.yml index b4109a03f2..bc43127fcd 100644 --- a/models/fixtures/webauthn_credential.yml +++ b/models/fixtures/webauthn_credential.yml @@ -1,5 +1,6 @@ -- id: 1 - name: "WebAuthn credential" +- + id: 1 + name: WebAuthn credential user_id: 32 attestation_type: none sign_count: 0 diff --git a/models/user/user_test.go b/models/user/user_test.go index 678d6c186c..5f2ac0a60c 100644 --- a/models/user/user_test.go +++ b/models/user/user_test.go @@ -102,7 +102,7 @@ func TestSearchUsers(t *testing.T) { []int64{9}) testUserSuccess(&user_model.SearchUserOptions{OrderBy: "id ASC", ListOptions: db.ListOptions{Page: 1}, IsActive: util.OptionalBoolTrue}, - []int64{1, 2, 4, 5, 8, 10, 11, 12, 13, 14, 15, 16, 18, 20, 21, 24, 28, 29, 30, 32}) + []int64{1, 2, 4, 5, 8, 10, 11, 12, 13, 14, 15, 16, 18, 20, 21, 24, 27, 28, 29, 30, 32}) testUserSuccess(&user_model.SearchUserOptions{Keyword: "user1", OrderBy: "id ASC", ListOptions: db.ListOptions{Page: 1}, IsActive: util.OptionalBoolTrue}, []int64{1, 10, 11, 12, 13, 14, 15, 16, 18}) diff --git a/routers/web/user/home_test.go b/routers/web/user/home_test.go index 9ad0711dc0..36e99bba5e 100644 --- a/routers/web/user/home_test.go +++ b/routers/web/user/home_test.go @@ -76,7 +76,7 @@ func TestPulls(t *testing.T) { Pulls(ctx) assert.EqualValues(t, http.StatusOK, ctx.Resp.Status()) - assert.Len(t, ctx.Data["Issues"], 3) + assert.Len(t, ctx.Data["Issues"], 4) } func TestMilestones(t *testing.T) { diff --git a/tests/integration/api_admin_test.go b/tests/integration/api_admin_test.go index dea0bdd063..d6bc6016ff 100644 --- a/tests/integration/api_admin_test.go +++ b/tests/integration/api_admin_test.go @@ -167,6 +167,33 @@ func TestAPICreateUserInvalidEmail(t *testing.T) { session.MakeRequest(t, req, http.StatusUnprocessableEntity) } +func TestAPICreateAndDeleteUser(t *testing.T) { + defer tests.PrepareTestEnv(t)() + adminUsername := "user1" + session := loginUser(t, adminUsername) + token := getTokenForLoggedInUser(t, session) + + req := NewRequestWithValues( + t, + "POST", + fmt.Sprintf("/api/v1/admin/users?token=%s", token), + map[string]string{ + "email": "deleteme@domain.com", + "full_name": "delete me", + "login_name": "deleteme", + "must_change_password": "true", + "password": "password", + "send_notify": "true", + "source_id": "0", + "username": "deleteme", + }, + ) + MakeRequest(t, req, http.StatusCreated) + + req = NewRequest(t, "DELETE", fmt.Sprintf("/api/v1/admin/users/deleteme?token=%s", token)) + MakeRequest(t, req, http.StatusNoContent) +} + func TestAPIEditUser(t *testing.T) { defer tests.PrepareTestEnv(t)() adminUsername := "user1" @@ -209,3 +236,20 @@ func TestAPIEditUser(t *testing.T) { user2 = unittest.AssertExistsAndLoadBean(t, &user_model.User{LoginName: "user2"}) assert.True(t, user2.IsRestricted) } + +func TestAPICreateRepoForUser(t *testing.T) { + defer tests.PrepareTestEnv(t)() + adminUsername := "user1" + session := loginUser(t, adminUsername) + token := getTokenForLoggedInUser(t, session) + + req := NewRequestWithJSON( + t, + "POST", + fmt.Sprintf("/api/v1/admin/users/%s/repos?token=%s", adminUsername, token), + &api.CreateRepoOption{ + Name: "admincreatedrepo", + }, + ) + MakeRequest(t, req, http.StatusCreated) +} diff --git a/tests/integration/api_feed_user_test.go b/tests/integration/api_feed_user_test.go new file mode 100644 index 0000000000..c137dd1209 --- /dev/null +++ b/tests/integration/api_feed_user_test.go @@ -0,0 +1,38 @@ +// Copyright 2022 The Gitea Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +package integration + +import ( + "net/http" + "testing" + + "code.gitea.io/gitea/tests" + + "github.com/stretchr/testify/assert" +) + +func TestFeed(t *testing.T) { + t.Run("User", func(t *testing.T) { + t.Run("Atom", func(t *testing.T) { + defer tests.PrepareTestEnv(t)() + + req := NewRequest(t, "GET", "/user2.atom") + resp := MakeRequest(t, req, http.StatusOK) + + data := resp.Body.String() + assert.Contains(t, data, `<feed xmlns="http://www.w3.org/2005/Atom"`) + }) + + t.Run("RSS", func(t *testing.T) { + defer tests.PrepareTestEnv(t)() + + req := NewRequest(t, "GET", "/user2.rss") + resp := MakeRequest(t, req, http.StatusOK) + + data := resp.Body.String() + assert.Contains(t, data, `<rss version="2.0"`) + }) + }) +} diff --git a/tests/integration/api_user_follow_test.go b/tests/integration/api_user_follow_test.go new file mode 100644 index 0000000000..e21556aa5b --- /dev/null +++ b/tests/integration/api_user_follow_test.go @@ -0,0 +1,111 @@ +// Copyright 2022 The Gitea Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +package integration + +import ( + "fmt" + "net/http" + "testing" + + api "code.gitea.io/gitea/modules/structs" + "code.gitea.io/gitea/tests" + + "github.com/stretchr/testify/assert" +) + +func TestAPIFollow(t *testing.T) { + defer tests.PrepareTestEnv(t)() + + user1 := "user4" + user2 := "user1" + + session1 := loginUser(t, user1) + token1 := getTokenForLoggedInUser(t, session1) + + session2 := loginUser(t, user2) + token2 := getTokenForLoggedInUser(t, session2) + + t.Run("Follow", func(t *testing.T) { + defer tests.PrintCurrentTest(t)() + + req := NewRequest(t, "PUT", fmt.Sprintf("/api/v1/user/following/%s?token=%s", user1, token2)) + MakeRequest(t, req, http.StatusNoContent) + }) + + t.Run("ListFollowing", func(t *testing.T) { + defer tests.PrintCurrentTest(t)() + + req := NewRequest(t, "GET", fmt.Sprintf("/api/v1/users/%s/following?token=%s", user2, token2)) + resp := MakeRequest(t, req, http.StatusOK) + + var users []api.User + DecodeJSON(t, resp, &users) + assert.Len(t, users, 1) + assert.Equal(t, user1, users[0].UserName) + }) + + t.Run("ListMyFollowing", func(t *testing.T) { + defer tests.PrintCurrentTest(t)() + + req := NewRequest(t, "GET", fmt.Sprintf("/api/v1/user/following?token=%s", token2)) + resp := MakeRequest(t, req, http.StatusOK) + + var users []api.User + DecodeJSON(t, resp, &users) + assert.Len(t, users, 1) + assert.Equal(t, user1, users[0].UserName) + }) + + t.Run("ListFollowers", func(t *testing.T) { + defer tests.PrintCurrentTest(t)() + + req := NewRequest(t, "GET", fmt.Sprintf("/api/v1/users/%s/followers?token=%s", user1, token1)) + resp := MakeRequest(t, req, http.StatusOK) + + var users []api.User + DecodeJSON(t, resp, &users) + assert.Len(t, users, 1) + assert.Equal(t, user2, users[0].UserName) + }) + + t.Run("ListMyFollowers", func(t *testing.T) { + defer tests.PrintCurrentTest(t)() + + req := NewRequest(t, "GET", fmt.Sprintf("/api/v1/user/followers?token=%s", token1)) + resp := MakeRequest(t, req, http.StatusOK) + + var users []api.User + DecodeJSON(t, resp, &users) + assert.Len(t, users, 1) + assert.Equal(t, user2, users[0].UserName) + }) + + t.Run("CheckFollowing", func(t *testing.T) { + defer tests.PrintCurrentTest(t)() + + req := NewRequest(t, "GET", fmt.Sprintf("/api/v1/users/%s/following/%s?token=%s", user2, user1, token2)) + MakeRequest(t, req, http.StatusNoContent) + + req = NewRequest(t, "GET", fmt.Sprintf("/api/v1/users/%s/following/%s?token=%s", user1, user2, token2)) + MakeRequest(t, req, http.StatusNotFound) + }) + + t.Run("CheckMyFollowing", func(t *testing.T) { + defer tests.PrintCurrentTest(t)() + + req := NewRequest(t, "GET", fmt.Sprintf("/api/v1/user/following/%s?token=%s", user1, token2)) + MakeRequest(t, req, http.StatusNoContent) + + req = NewRequest(t, "GET", fmt.Sprintf("/api/v1/user/following/%s?token=%s", user2, token1)) + MakeRequest(t, req, http.StatusNotFound) + }) + + t.Run("Unfollow", func(t *testing.T) { + defer tests.PrintCurrentTest(t)() + + req := NewRequest(t, "DELETE", fmt.Sprintf("/api/v1/user/following/%s?token=%s", user1, token2)) + MakeRequest(t, req, http.StatusNoContent) + }) +} diff --git a/tests/integration/api_user_info_test.go b/tests/integration/api_user_info_test.go new file mode 100644 index 0000000000..27fec1d587 --- /dev/null +++ b/tests/integration/api_user_info_test.go @@ -0,0 +1,51 @@ +// Copyright 2022 The Gitea Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +package integration + +import ( + "fmt" + "net/http" + "testing" + + api "code.gitea.io/gitea/modules/structs" + "code.gitea.io/gitea/tests" + + "github.com/stretchr/testify/assert" +) + +func TestAPIUserInfo(t *testing.T) { + defer tests.PrepareTestEnv(t)() + + user := "user1" + user2 := "user31" + + session := loginUser(t, user) + token := getTokenForLoggedInUser(t, session) + + t.Run("GetInfo", func(t *testing.T) { + defer tests.PrintCurrentTest(t)() + + req := NewRequest(t, "GET", fmt.Sprintf("/api/v1/users/%s?token=%s", user2, token)) + resp := MakeRequest(t, req, http.StatusOK) + + var u api.User + DecodeJSON(t, resp, &u) + assert.Equal(t, user2, u.UserName) + + req = NewRequest(t, "GET", fmt.Sprintf("/api/v1/users/%s", user2)) + MakeRequest(t, req, http.StatusNotFound) + }) + + t.Run("GetAuthenticatedUser", func(t *testing.T) { + defer tests.PrintCurrentTest(t)() + + req := NewRequest(t, "GET", fmt.Sprintf("/api/v1/user?token=%s", token)) + resp := MakeRequest(t, req, http.StatusOK) + + var u api.User + DecodeJSON(t, resp, &u) + assert.Equal(t, user, u.UserName) + }) +} diff --git a/tests/integration/api_user_star_test.go b/tests/integration/api_user_star_test.go new file mode 100644 index 0000000000..76c3dc2d17 --- /dev/null +++ b/tests/integration/api_user_star_test.go @@ -0,0 +1,78 @@ +// Copyright 2022 The Gitea Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +package integration + +import ( + "fmt" + "net/http" + "testing" + + api "code.gitea.io/gitea/modules/structs" + "code.gitea.io/gitea/tests" + + "github.com/stretchr/testify/assert" +) + +func TestAPIStar(t *testing.T) { + defer tests.PrepareTestEnv(t)() + + user := "user1" + repo := "user2/repo1" + + session := loginUser(t, user) + token := getTokenForLoggedInUser(t, session) + + t.Run("Star", func(t *testing.T) { + defer tests.PrintCurrentTest(t)() + + req := NewRequest(t, "PUT", fmt.Sprintf("/api/v1/user/starred/%s?token=%s", repo, token)) + MakeRequest(t, req, http.StatusNoContent) + }) + + t.Run("GetStarredRepos", func(t *testing.T) { + defer tests.PrintCurrentTest(t)() + + req := NewRequest(t, "GET", fmt.Sprintf("/api/v1/users/%s/starred?token=%s", user, token)) + resp := MakeRequest(t, req, http.StatusOK) + + assert.Equal(t, "1", resp.Header().Get("X-Total-Count")) + + var repos []api.Repository + DecodeJSON(t, resp, &repos) + assert.Len(t, repos, 1) + assert.Equal(t, repo, repos[0].FullName) + }) + + t.Run("GetMyStarredRepos", func(t *testing.T) { + defer tests.PrintCurrentTest(t)() + + req := NewRequest(t, "GET", fmt.Sprintf("/api/v1/user/starred?token=%s", token)) + resp := MakeRequest(t, req, http.StatusOK) + + assert.Equal(t, "1", resp.Header().Get("X-Total-Count")) + + var repos []api.Repository + DecodeJSON(t, resp, &repos) + assert.Len(t, repos, 1) + assert.Equal(t, repo, repos[0].FullName) + }) + + t.Run("IsStarring", func(t *testing.T) { + defer tests.PrintCurrentTest(t)() + + req := NewRequest(t, "GET", fmt.Sprintf("/api/v1/user/starred/%s?token=%s", repo, token)) + MakeRequest(t, req, http.StatusNoContent) + + req = NewRequest(t, "GET", fmt.Sprintf("/api/v1/user/starred/%s?token=%s", repo+"notexisting", token)) + MakeRequest(t, req, http.StatusNotFound) + }) + + t.Run("Unstar", func(t *testing.T) { + defer tests.PrintCurrentTest(t)() + + req := NewRequest(t, "DELETE", fmt.Sprintf("/api/v1/user/starred/%s?token=%s", repo, token)) + MakeRequest(t, req, http.StatusNoContent) + }) +} diff --git a/tests/integration/api_user_watch_test.go b/tests/integration/api_user_watch_test.go new file mode 100644 index 0000000000..e45050a278 --- /dev/null +++ b/tests/integration/api_user_watch_test.go @@ -0,0 +1,78 @@ +// Copyright 2022 The Gitea Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +package integration + +import ( + "fmt" + "net/http" + "testing" + + api "code.gitea.io/gitea/modules/structs" + "code.gitea.io/gitea/tests" + + "github.com/stretchr/testify/assert" +) + +func TestAPIWatch(t *testing.T) { + defer tests.PrepareTestEnv(t)() + + user := "user1" + repo := "user2/repo1" + + session := loginUser(t, user) + token := getTokenForLoggedInUser(t, session) + + t.Run("Watch", func(t *testing.T) { + defer tests.PrintCurrentTest(t)() + + req := NewRequest(t, "PUT", fmt.Sprintf("/api/v1/repos/%s/subscription?token=%s", repo, token)) + MakeRequest(t, req, http.StatusOK) + }) + + t.Run("GetWatchedRepos", func(t *testing.T) { + defer tests.PrintCurrentTest(t)() + + req := NewRequest(t, "GET", fmt.Sprintf("/api/v1/users/%s/subscriptions?token=%s", user, token)) + resp := MakeRequest(t, req, http.StatusOK) + + assert.Equal(t, "1", resp.Header().Get("X-Total-Count")) + + var repos []api.Repository + DecodeJSON(t, resp, &repos) + assert.Len(t, repos, 1) + assert.Equal(t, repo, repos[0].FullName) + }) + + t.Run("GetMyWatchedRepos", func(t *testing.T) { + defer tests.PrintCurrentTest(t)() + + req := NewRequest(t, "GET", fmt.Sprintf("/api/v1/user/subscriptions?token=%s", token)) + resp := MakeRequest(t, req, http.StatusOK) + + assert.Equal(t, "1", resp.Header().Get("X-Total-Count")) + + var repos []api.Repository + DecodeJSON(t, resp, &repos) + assert.Len(t, repos, 1) + assert.Equal(t, repo, repos[0].FullName) + }) + + t.Run("IsWatching", func(t *testing.T) { + defer tests.PrintCurrentTest(t)() + + req := NewRequest(t, "GET", fmt.Sprintf("/api/v1/repos/%s/subscription?token=%s", repo, token)) + MakeRequest(t, req, http.StatusOK) + + req = NewRequest(t, "GET", fmt.Sprintf("/api/v1/repos/%s/subscription?token=%s", repo+"notexisting", token)) + MakeRequest(t, req, http.StatusNotFound) + }) + + t.Run("Unwatch", func(t *testing.T) { + defer tests.PrintCurrentTest(t)() + + req := NewRequest(t, "DELETE", fmt.Sprintf("/api/v1/repos/%s/subscription?token=%s", repo, token)) + MakeRequest(t, req, http.StatusNoContent) + }) +} |