From 5b0cdd615567e49766fc7451cae84da17e152cea Mon Sep 17 00:00:00 2001 From: KN4CK3R Date: Sat, 26 Feb 2022 07:15:25 +0100 Subject: [PATCH] Set is_empty in fixtures (#18869) --- .../user30/empty.git/HEAD | 1 + .../user30/empty.git/config | 6 ++++ models/fixtures/repository.yml | 32 ++++++++++++++++++- models/fixtures/user.yml | 2 +- services/repository/files/content_test.go | 8 ++--- 5 files changed, 43 insertions(+), 6 deletions(-) create mode 100644 integrations/gitea-repositories-meta/user30/empty.git/HEAD create mode 100644 integrations/gitea-repositories-meta/user30/empty.git/config diff --git a/integrations/gitea-repositories-meta/user30/empty.git/HEAD b/integrations/gitea-repositories-meta/user30/empty.git/HEAD new file mode 100644 index 000000000..b870d8262 --- /dev/null +++ b/integrations/gitea-repositories-meta/user30/empty.git/HEAD @@ -0,0 +1 @@ +ref: refs/heads/main diff --git a/integrations/gitea-repositories-meta/user30/empty.git/config b/integrations/gitea-repositories-meta/user30/empty.git/config new file mode 100644 index 000000000..7c968c3b5 --- /dev/null +++ b/integrations/gitea-repositories-meta/user30/empty.git/config @@ -0,0 +1,6 @@ +[core] + bare = true + repositoryformatversion = 0 + filemode = false + symlinks = false + ignorecase = true diff --git a/models/fixtures/repository.yml b/models/fixtures/repository.yml index 891c5b2cd..475cda3b5 100644 --- a/models/fixtures/repository.yml +++ b/models/fixtures/repository.yml @@ -24,6 +24,7 @@ owner_name: user2 lower_name: repo2 name: repo2 + is_empty: false is_archived: false is_private: true num_issues: 2 @@ -40,6 +41,7 @@ owner_name: user3 lower_name: repo3 name: repo3 + is_empty: false is_private: true num_issues: 1 num_closed_issues: 0 @@ -56,6 +58,7 @@ owner_name: user5 lower_name: repo4 name: repo4 + is_empty: false is_private: false num_issues: 0 num_closed_issues: 0 @@ -143,6 +146,7 @@ owner_name: user12 lower_name: repo10 name: repo10 + is_empty: false is_private: false num_issues: 0 num_closed_issues: 0 @@ -160,6 +164,7 @@ owner_name: user13 lower_name: repo11 name: repo11 + is_empty: false is_private: false num_issues: 0 num_closed_issues: 0 @@ -217,7 +222,7 @@ owner_name: user2 lower_name: repo15 name: repo15 - is_empty: true + is_empty: false is_private: true status: 0 @@ -227,6 +232,7 @@ owner_name: user2 lower_name: repo16 name: repo16 + is_empty: false is_private: true num_issues: 0 num_closed_issues: 0 @@ -460,6 +466,7 @@ owner_name: user2 lower_name: repo20 name: repo20 + is_empty: false is_private: true num_stars: 0 num_forks: 0 @@ -486,6 +493,7 @@ owner_name: user2 lower_name: utf8 name: utf8 + is_empty: false is_private: false status: 0 @@ -521,6 +529,7 @@ owner_name: user2 lower_name: commits_search_test name: commits_search_test + is_empty: false is_private: false num_stars: 0 num_forks: 0 @@ -534,6 +543,7 @@ owner_name: user2 lower_name: git_hooks_test name: git_hooks_test + is_empty: false is_private: false num_stars: 0 num_forks: 0 @@ -547,6 +557,7 @@ owner_name: limited_org lower_name: public_repo_on_limited_org name: public_repo_on_limited_org + is_empty: false is_private: false num_stars: 0 num_forks: 0 @@ -560,6 +571,7 @@ owner_name: limited_org lower_name: private_repo_on_limited_org name: private_repo_on_limited_org + is_empty: false is_private: true num_stars: 0 num_forks: 0 @@ -573,6 +585,7 @@ owner_name: privated_org lower_name: public_repo_on_private_org name: public_repo_on_private_org + is_empty: false is_private: false num_stars: 0 num_forks: 0 @@ -586,6 +599,7 @@ owner_name: privated_org lower_name: private_repo_on_private_org name: private_repo_on_private_org + is_empty: false is_private: true num_stars: 0 num_forks: 0 @@ -598,6 +612,7 @@ owner_name: user2 lower_name: glob name: glob + is_empty: false is_private: false num_stars: 0 num_forks: 0 @@ -624,6 +639,7 @@ owner_name: user27 lower_name: template1 name: template1 + is_empty: false is_private: false is_template: true num_stars: 0 @@ -652,6 +668,7 @@ owner_name: org26 lower_name: repo_external_tracker name: repo_external_tracker + is_empty: false is_private: false num_stars: 0 num_forks: 0 @@ -665,6 +682,7 @@ owner_name: org26 lower_name: repo_external_tracker_numeric name: repo_external_tracker_numeric + is_empty: false is_private: false num_stars: 0 num_forks: 0 @@ -678,6 +696,7 @@ owner_name: org26 lower_name: repo_external_tracker_alpha name: repo_external_tracker_alpha + is_empty: false is_private: false num_stars: 0 num_forks: 0 @@ -692,6 +711,7 @@ owner_name: user27 lower_name: repo49 name: repo49 + is_empty: false is_private: false num_stars: 0 num_forks: 0 @@ -738,3 +758,13 @@ num_projects: 0 num_closed_projects: 0 status: 0 + +- + id: 52 + owner_id: 30 + owner_name: user30 + lower_name: empty + name: empty + is_empty: true + is_private: true + status: 0 diff --git a/models/fixtures/user.yml b/models/fixtures/user.yml index cf07542ee..670b30562 100644 --- a/models/fixtures/user.yml +++ b/models/fixtures/user.yml @@ -522,7 +522,7 @@ is_restricted: true avatar: avatar29 avatar_email: user30@example.com - num_repos: 2 + num_repos: 3 is_active: true prohibit_login: true diff --git a/services/repository/files/content_test.go b/services/repository/files/content_test.go index c21aa31d3..84bb1c2e0 100644 --- a/services/repository/files/content_test.go +++ b/services/repository/files/content_test.go @@ -203,10 +203,10 @@ func TestGetContentsOrListErrors(t *testing.T) { func TestGetContentsOrListOfEmptyRepos(t *testing.T) { unittest.PrepareTestEnv(t) - ctx := test.MockContext(t, "user2/repo15") - ctx.SetParams(":id", "15") - test.LoadRepo(t, ctx, 15) - test.LoadUser(t, ctx, 2) + ctx := test.MockContext(t, "user30/empty") + ctx.SetParams(":id", "52") + test.LoadRepo(t, ctx, 52) + test.LoadUser(t, ctx, 30) test.LoadGitRepo(t, ctx) defer ctx.Repo.GitRepo.Close()