From ca68a75b5b8d457f56905ebb7e56d4b7c4566c2e Mon Sep 17 00:00:00 2001 From: Morlinest Date: Fri, 22 Sep 2017 12:51:16 +0200 Subject: [PATCH] Expand fixtures (#2571) * Add more repo search tests * Add and fix /api/repo/search integration tests * Add owner to access table for organization repositories * Remove tests --- models/fixtures/access.yml | 24 +++++++++ models/fixtures/org_user.yml | 8 +++ models/fixtures/repository.yml | 97 ++++++++++++++++++++++++++++++++++ models/fixtures/team.yml | 9 ++++ models/fixtures/team_repo.yml | 12 +++++ models/fixtures/team_user.yml | 6 +++ models/fixtures/user.yml | 47 ++++++++++++++++ models/org_test.go | 2 +- 8 files changed, 204 insertions(+), 1 deletion(-) diff --git a/models/fixtures/access.yml b/models/fixtures/access.yml index 8722b248d..34d5c5c59 100644 --- a/models/fixtures/access.yml +++ b/models/fixtures/access.yml @@ -15,3 +15,27 @@ user_id: 4 repo_id: 3 mode: 2 # write + +- + id: 4 + user_id: 15 + repo_id: 22 + mode: 2 # write + +- + id: 5 + user_id: 15 + repo_id: 21 + mode: 2 # write + +- + id: 6 + user_id: 15 + repo_id: 23 + mode: 4 # owner + +- + id: 7 + user_id: 15 + repo_id: 24 + mode: 4 # owner \ No newline at end of file diff --git a/models/fixtures/org_user.yml b/models/fixtures/org_user.yml index a7b8d178a..c7fe2cf36 100644 --- a/models/fixtures/org_user.yml +++ b/models/fixtures/org_user.yml @@ -29,3 +29,11 @@ is_public: false is_owner: true num_teams: 1 + +- + id: 5 + uid: 15 + org_id: 17 + is_public: true + is_owner: true + num_teams: 1 diff --git a/models/fixtures/repository.yml b/models/fixtures/repository.yml index 51812d358..eb83dfcff 100644 --- a/models/fixtures/repository.yml +++ b/models/fixtures/repository.yml @@ -188,3 +188,100 @@ num_pulls: 0 num_closed_pulls: 0 num_watches: 0 + +- + id: 17 + owner_id: 15 + lower_name: big_test_public_1 + name: big_test_public_1 + is_private: false + num_issues: 0 + num_closed_issues: 0 + num_pulls: 0 + num_closed_pulls: 0 + num_watches: 0 + is_mirror: false + +- + id: 18 + owner_id: 15 + lower_name: big_test_public_2 + name: big_test_public_2 + is_private: false + num_issues: 0 + num_closed_issues: 0 + num_pulls: 0 + num_closed_pulls: 0 + is_mirror: false + +- + id: 19 + owner_id: 15 + lower_name: big_test_private_1 + name: big_test_private_1 + is_private: true + num_issues: 0 + num_closed_issues: 0 + num_pulls: 0 + num_closed_pulls: 0 + is_mirror: false + +- + id: 20 + owner_id: 15 + lower_name: big_test_private_2 + name: big_test_private_2 + is_private: true + num_issues: 0 + num_closed_issues: 0 + num_pulls: 0 + num_closed_pulls: 0 + is_mirror: false + +- + id: 21 + owner_id: 16 + lower_name: big_test_public_3 + name: big_test_public_3 + is_private: false + num_issues: 0 + num_closed_issues: 0 + num_pulls: 0 + num_closed_pulls: 0 + is_mirror: false + +- + id: 22 + owner_id: 16 + lower_name: big_test_private_3 + name: big_test_private_3 + is_private: true + num_issues: 0 + num_closed_issues: 0 + num_pulls: 0 + num_closed_pulls: 0 + is_mirror: false + +- + id: 23 + owner_id: 17 + lower_name: big_test_public_4 + name: big_test_public_4 + is_private: false + num_issues: 0 + num_closed_issues: 0 + num_pulls: 0 + num_closed_pulls: 0 + is_mirror: false + +- + id: 24 + owner_id: 17 + lower_name: big_test_private_4 + name: big_test_private_4 + is_private: true + num_issues: 0 + num_closed_issues: 0 + num_pulls: 0 + num_closed_pulls: 0 + is_mirror: false diff --git a/models/fixtures/team.yml b/models/fixtures/team.yml index 795d5cda6..298de648d 100644 --- a/models/fixtures/team.yml +++ b/models/fixtures/team.yml @@ -37,3 +37,12 @@ num_repos: 0 num_members: 1 unit_types: '[1,2,3,4,5,6,7]' +- + id: 5 + org_id: 17 + lower_name: owners + name: Owners + authorize: 4 # owner + num_repos: 2 + num_members: 1 + unit_types: '[1,2,3,4,5,6,7]' diff --git a/models/fixtures/team_repo.yml b/models/fixtures/team_repo.yml index 1f7385e7e..5154453f7 100644 --- a/models/fixtures/team_repo.yml +++ b/models/fixtures/team_repo.yml @@ -15,3 +15,15 @@ org_id: 3 team_id: 1 repo_id: 5 + +- + id: 4 + org_id: 17 + team_id: 5 + repo_id: 23 + +- + id: 5 + org_id: 17 + team_id: 5 + repo_id: 24 \ No newline at end of file diff --git a/models/fixtures/team_user.yml b/models/fixtures/team_user.yml index 955a80e4c..8d9d92037 100644 --- a/models/fixtures/team_user.yml +++ b/models/fixtures/team_user.yml @@ -27,3 +27,9 @@ org_id: 7 team_id: 4 uid: 5 + +- + id: 6 + org_id: 17 + team_id: 5 + uid: 15 \ No newline at end of file diff --git a/models/fixtures/user.yml b/models/fixtures/user.yml index abd72b116..e1fbc9e57 100644 --- a/models/fixtures/user.yml +++ b/models/fixtures/user.yml @@ -218,3 +218,50 @@ avatar_email: user13@example.com num_repos: 3 is_active: true + +- + id: 15 + lower_name: user15 + name: user15 + full_name: User 15 + email: user15@example.com + passwd: 7d93daa0d1e6f2305cc8fa496847d61dc7320bb16262f9c55dd753480207234cdd96a93194e408341971742f4701772a025a # password + type: 0 # individual + salt: ZogKvWdyEx + is_admin: false + avatar: avatar15 + avatar_email: user15@example.com + num_repos: 4 + is_active: true + +- + id: 16 + lower_name: user16 + name: user16 + full_name: User 16 + email: user16@example.com + passwd: 7d93daa0d1e6f2305cc8fa496847d61dc7320bb16262f9c55dd753480207234cdd96a93194e408341971742f4701772a025a # password + type: 0 # individual + salt: ZogKvWdyEx + is_admin: false + avatar: avatar16 + avatar_email: user16@example.com + num_repos: 2 + is_active: true + +- + id: 17 + lower_name: user17 + name: user17 + full_name: User 17 + email: user17@example.com + passwd: 7d93daa0d1e6f2305cc8fa496847d61dc7320bb16262f9c55dd753480207234cdd96a93194e408341971742f4701772a025a # password + type: 1 # organization + salt: ZogKvWdyEx + is_admin: false + avatar: avatar17 + avatar_email: user17@example.com + num_repos: 2 + is_active: true + num_members: 1 + num_teams: 1 \ No newline at end of file diff --git a/models/org_test.go b/models/org_test.go index 07da2d56a..c7bdb8b5d 100644 --- a/models/org_test.go +++ b/models/org_test.go @@ -252,7 +252,7 @@ func TestOrganizations(t *testing.T) { []int64{3, 6}) testSuccess(&SearchUserOptions{OrderBy: "id ASC", Page: 2, PageSize: 2}, - []int64{7}) + []int64{7, 17}) testSuccess(&SearchUserOptions{Page: 3, PageSize: 2}, []int64{})