aboutsummaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
Diffstat (limited to 'models')
-rw-r--r--models/fixtures/access.yml24
-rw-r--r--models/fixtures/collaboration.yml6
-rw-r--r--models/fixtures/email_address.yml24
-rw-r--r--models/fixtures/issue.yml34
-rw-r--r--models/fixtures/org_user.yml18
-rw-r--r--models/fixtures/pull_request.yml18
-rw-r--r--models/fixtures/repo_unit.yml42
-rw-r--r--models/fixtures/repository.yml62
-rw-r--r--models/fixtures/team.yml22
-rw-r--r--models/fixtures/team_repo.yml12
-rw-r--r--models/fixtures/team_unit.yml36
-rw-r--r--models/fixtures/team_user.yml18
-rw-r--r--models/fixtures/user.yml148
-rw-r--r--models/issues/issue_test.go2
-rw-r--r--models/repo/repo_list_test.go6
-rw-r--r--models/user/user_test.go6
16 files changed, 471 insertions, 7 deletions
diff --git a/models/fixtures/access.yml b/models/fixtures/access.yml
index 1bb6a9a8ac..641c453eb7 100644
--- a/models/fixtures/access.yml
+++ b/models/fixtures/access.yml
@@ -135,3 +135,27 @@
user_id: 31
repo_id: 28
mode: 4
+
+-
+ id: 24
+ user_id: 38
+ repo_id: 60
+ mode: 2
+
+-
+ id: 25
+ user_id: 38
+ repo_id: 61
+ mode: 1
+
+-
+ id: 26
+ user_id: 39
+ repo_id: 61
+ mode: 1
+
+-
+ id: 27
+ user_id: 40
+ repo_id: 61
+ mode: 4
diff --git a/models/fixtures/collaboration.yml b/models/fixtures/collaboration.yml
index ef77d22b24..7603bdad32 100644
--- a/models/fixtures/collaboration.yml
+++ b/models/fixtures/collaboration.yml
@@ -45,3 +45,9 @@
repo_id: 22
user_id: 18
mode: 2 # write
+
+-
+ id: 9
+ repo_id: 60
+ user_id: 38
+ mode: 2 # write
diff --git a/models/fixtures/email_address.yml b/models/fixtures/email_address.yml
index 67a99f43e2..b2a0432635 100644
--- a/models/fixtures/email_address.yml
+++ b/models/fixtures/email_address.yml
@@ -293,3 +293,27 @@
lower_email: user37@example.com
is_activated: true
is_primary: true
+
+-
+ id: 38
+ uid: 38
+ email: user38@example.com
+ lower_email: user38@example.com
+ is_activated: true
+ is_primary: true
+
+-
+ id: 39
+ uid: 39
+ email: user39@example.com
+ lower_email: user39@example.com
+ is_activated: true
+ is_primary: true
+
+-
+ id: 40
+ uid: 40
+ email: user40@example.com
+ lower_email: user40@example.com
+ is_activated: true
+ is_primary: true
diff --git a/models/fixtures/issue.yml b/models/fixtures/issue.yml
index 0c9b6ff406..ca5b1c6cd1 100644
--- a/models/fixtures/issue.yml
+++ b/models/fixtures/issue.yml
@@ -338,3 +338,37 @@
created_unix: 978307210
updated_unix: 978307210
is_locked: false
+
+-
+ id: 21
+ repo_id: 60
+ index: 1
+ poster_id: 39
+ original_author_id: 0
+ name: repo60 pull1
+ content: content for the 1st issue
+ milestone_id: 0
+ priority: 0
+ is_closed: false
+ is_pull: true
+ num_comments: 0
+ created_unix: 1707270422
+ updated_unix: 1707270422
+ is_locked: false
+
+-
+ id: 22
+ repo_id: 61
+ index: 1
+ poster_id: 40
+ original_author_id: 0
+ name: repo61 pull1
+ content: content for the 1st issue
+ milestone_id: 0
+ priority: 0
+ is_closed: false
+ is_pull: true
+ num_comments: 0
+ created_unix: 1707270422
+ updated_unix: 1707270422
+ is_locked: false
diff --git a/models/fixtures/org_user.yml b/models/fixtures/org_user.yml
index 8d58169a32..a7fbcb2c5a 100644
--- a/models/fixtures/org_user.yml
+++ b/models/fixtures/org_user.yml
@@ -99,3 +99,21 @@
uid: 5
org_id: 36
is_public: true
+
+-
+ id: 18
+ uid: 38
+ org_id: 41
+ is_public: true
+
+-
+ id: 19
+ uid: 39
+ org_id: 41
+ is_public: true
+
+-
+ id: 20
+ uid: 40
+ org_id: 41
+ is_public: true
diff --git a/models/fixtures/pull_request.yml b/models/fixtures/pull_request.yml
index 54590fb830..3fc8ce630d 100644
--- a/models/fixtures/pull_request.yml
+++ b/models/fixtures/pull_request.yml
@@ -99,3 +99,21 @@
index: 1
head_repo_id: 23
base_repo_id: 23
+
+-
+ id: 9
+ type: 0 # gitea pull request
+ status: 2 # mergable
+ issue_id: 21
+ index: 1
+ head_repo_id: 60
+ base_repo_id: 60
+
+-
+ id: 10
+ type: 0 # gitea pull request
+ status: 2 # mergable
+ issue_id: 22
+ index: 1
+ head_repo_id: 61
+ base_repo_id: 61
diff --git a/models/fixtures/repo_unit.yml b/models/fixtures/repo_unit.yml
index e6c59f527a..4b26674990 100644
--- a/models/fixtures/repo_unit.yml
+++ b/models/fixtures/repo_unit.yml
@@ -676,3 +676,45 @@
type: 1
config: "{}"
created_unix: 946684810
+
+-
+ id: 102
+ repo_id: 60
+ type: 1
+ config: "{}"
+ created_unix: 946684810
+
+-
+ id: 103
+ repo_id: 60
+ type: 2
+ config: "{\"EnableTimetracker\":true,\"AllowOnlyContributorsToTrackTime\":true}"
+ created_unix: 946684810
+
+-
+ id: 104
+ repo_id: 60
+ type: 3
+ config: "{\"IgnoreWhitespaceConflicts\":false,\"AllowMerge\":true,\"AllowRebase\":true,\"AllowRebaseMerge\":true,\"AllowSquash\":true}"
+ created_unix: 946684810
+
+-
+ id: 105
+ repo_id: 61
+ type: 1
+ config: "{}"
+ created_unix: 946684810
+
+-
+ id: 106
+ repo_id: 61
+ type: 2
+ config: "{\"EnableTimetracker\":true,\"AllowOnlyContributorsToTrackTime\":true}"
+ created_unix: 946684810
+
+-
+ id: 107
+ repo_id: 61
+ type: 3
+ config: "{\"IgnoreWhitespaceConflicts\":false,\"AllowMerge\":true,\"AllowRebase\":true,\"AllowRebaseMerge\":true,\"AllowSquash\":true}"
+ created_unix: 946684810
diff --git a/models/fixtures/repository.yml b/models/fixtures/repository.yml
index f4e8376735..d094fe82d8 100644
--- a/models/fixtures/repository.yml
+++ b/models/fixtures/repository.yml
@@ -1706,3 +1706,65 @@
is_private: true
status: 0
num_issues: 0
+
+-
+ id: 60
+ owner_id: 40
+ owner_name: user40
+ lower_name: repo60
+ name: repo60
+ default_branch: main
+ 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: 61
+ owner_id: 41
+ owner_name: org41
+ lower_name: repo61
+ name: repo61
+ default_branch: main
+ 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
diff --git a/models/fixtures/team.yml b/models/fixtures/team.yml
index 295e51e39c..149fe90888 100644
--- a/models/fixtures/team.yml
+++ b/models/fixtures/team.yml
@@ -217,3 +217,25 @@
num_members: 1
includes_all_repositories: false
can_create_org_repo: true
+
+-
+ id: 21
+ org_id: 41
+ lower_name: owners
+ name: Owners
+ authorize: 4 # owner
+ num_repos: 1
+ num_members: 1
+ includes_all_repositories: true
+ can_create_org_repo: true
+
+-
+ id: 22
+ org_id: 41
+ lower_name: team1
+ name: Team1
+ authorize: 1 # read
+ num_repos: 1
+ num_members: 2
+ includes_all_repositories: false
+ can_create_org_repo: false
diff --git a/models/fixtures/team_repo.yml b/models/fixtures/team_repo.yml
index 8497720892..a29078107e 100644
--- a/models/fixtures/team_repo.yml
+++ b/models/fixtures/team_repo.yml
@@ -63,3 +63,15 @@
org_id: 17
team_id: 9
repo_id: 24
+
+-
+ id: 12
+ org_id: 41
+ team_id: 21
+ repo_id: 61
+
+-
+ id: 13
+ org_id: 41
+ team_id: 22
+ repo_id: 61
diff --git a/models/fixtures/team_unit.yml b/models/fixtures/team_unit.yml
index c5531aa57a..de0e8d738b 100644
--- a/models/fixtures/team_unit.yml
+++ b/models/fixtures/team_unit.yml
@@ -286,3 +286,39 @@
team_id: 2
type: 8
access_mode: 2
+
+-
+ id: 49
+ team_id: 21
+ type: 1
+ access_mode: 4
+
+-
+ id: 50
+ team_id: 21
+ type: 2
+ access_mode: 4
+
+-
+ id: 51
+ team_id: 21
+ type: 3
+ access_mode: 4
+
+-
+ id: 52
+ team_id: 22
+ type: 1
+ access_mode: 1
+
+-
+ id: 53
+ team_id: 22
+ type: 2
+ access_mode: 1
+
+-
+ id: 54
+ team_id: 22
+ type: 3
+ access_mode: 1
diff --git a/models/fixtures/team_user.yml b/models/fixtures/team_user.yml
index 9142fe609a..02d57ae644 100644
--- a/models/fixtures/team_user.yml
+++ b/models/fixtures/team_user.yml
@@ -129,3 +129,21 @@
org_id: 17
team_id: 9
uid: 15
+
+-
+ id: 23
+ org_id: 41
+ team_id: 21
+ uid: 40
+
+-
+ id: 24
+ org_id: 41
+ team_id: 22
+ uid: 38
+
+-
+ id: 25
+ org_id: 41
+ team_id: 22
+ uid: 39
diff --git a/models/fixtures/user.yml b/models/fixtures/user.yml
index aa0daedd85..16b687ae04 100644
--- a/models/fixtures/user.yml
+++ b/models/fixtures/user.yml
@@ -1369,3 +1369,151 @@
repo_admin_change_team_access: false
theme: ""
keep_activity_private: false
+
+-
+ id: 38
+ lower_name: user38
+ name: user38
+ full_name: User38
+ email: user38@example.com
+ keep_email_private: false
+ email_notifications_preference: enabled
+ passwd: ZogKvWdyEx:password
+ passwd_hash_algo: dummy
+ must_change_password: false
+ login_source: 0
+ login_name: user38
+ 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: avatar38
+ avatar_email: user38@example.com
+ use_custom_avatar: false
+ num_followers: 0
+ num_following: 0
+ 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: 39
+ lower_name: user39
+ name: user39
+ full_name: User39
+ email: user39@example.com
+ keep_email_private: false
+ email_notifications_preference: enabled
+ passwd: ZogKvWdyEx:password
+ passwd_hash_algo: dummy
+ must_change_password: false
+ login_source: 0
+ login_name: user39
+ 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: avatar39
+ avatar_email: user39@example.com
+ use_custom_avatar: false
+ num_followers: 0
+ num_following: 0
+ 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: 40
+ lower_name: user40
+ name: user40
+ full_name: User40
+ email: user40@example.com
+ keep_email_private: false
+ email_notifications_preference: onmention
+ passwd: ZogKvWdyEx:password
+ passwd_hash_algo: dummy
+ must_change_password: false
+ login_source: 0
+ login_name: user40
+ 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: avatar40
+ avatar_email: user40@example.com
+ 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: 41
+ lower_name: org41
+ name: org41
+ full_name: Org41
+ email: org41@example.com
+ keep_email_private: false
+ email_notifications_preference: onmention
+ passwd: ZogKvWdyEx:password
+ passwd_hash_algo: dummy
+ must_change_password: false
+ login_source: 0
+ login_name: org41
+ 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: avatar41
+ avatar_email: org41@example.com
+ use_custom_avatar: false
+ num_followers: 0
+ num_following: 0
+ num_stars: 0
+ num_repos: 1
+ num_teams: 2
+ num_members: 3
+ visibility: 0
+ repo_admin_change_team_access: false
+ theme: ""
+ keep_activity_private: false
diff --git a/models/issues/issue_test.go b/models/issues/issue_test.go
index cc363d2fae..1bbc0eee56 100644
--- a/models/issues/issue_test.go
+++ b/models/issues/issue_test.go
@@ -379,7 +379,7 @@ func TestCountIssues(t *testing.T) {
assert.NoError(t, unittest.PrepareTestDatabase())
count, err := issues_model.CountIssues(db.DefaultContext, &issues_model.IssuesOptions{})
assert.NoError(t, err)
- assert.EqualValues(t, 20, count)
+ assert.EqualValues(t, 22, count)
}
func TestIssueLoadAttributes(t *testing.T) {
diff --git a/models/repo/repo_list_test.go b/models/repo/repo_list_test.go
index 8a1799aac0..83e37a27fd 100644
--- a/models/repo/repo_list_test.go
+++ b/models/repo/repo_list_test.go
@@ -138,12 +138,12 @@ func getTestCases() []struct {
{
name: "AllPublic/PublicRepositoriesOfUserIncludingCollaborative",
opts: &repo_model.SearchRepoOptions{ListOptions: db.ListOptions{Page: 1, PageSize: 10}, OwnerID: 15, AllPublic: true, Template: util.OptionalBoolFalse},
- count: 31,
+ count: 33,
},
{
name: "AllPublic/PublicAndPrivateRepositoriesOfUserIncludingCollaborative",
opts: &repo_model.SearchRepoOptions{ListOptions: db.ListOptions{Page: 1, PageSize: 10}, OwnerID: 15, Private: true, AllPublic: true, AllLimited: true, Template: util.OptionalBoolFalse},
- count: 36,
+ count: 38,
},
{
name: "AllPublic/PublicAndPrivateRepositoriesOfUserIncludingCollaborativeByName",
@@ -158,7 +158,7 @@ func getTestCases() []struct {
{
name: "AllPublic/PublicRepositoriesOfOrganization",
opts: &repo_model.SearchRepoOptions{ListOptions: db.ListOptions{Page: 1, PageSize: 10}, OwnerID: 17, AllPublic: true, Collaborate: util.OptionalBoolFalse, Template: util.OptionalBoolFalse},
- count: 31,
+ count: 33,
},
{
name: "AllTemplates",
diff --git a/models/user/user_test.go b/models/user/user_test.go
index f3e5a95b1e..68cee9cdbd 100644
--- a/models/user/user_test.go
+++ b/models/user/user_test.go
@@ -89,7 +89,7 @@ func TestSearchUsers(t *testing.T) {
[]int64{19, 25})
testOrgSuccess(&user_model.SearchUserOptions{OrderBy: "id ASC", ListOptions: db.ListOptions{Page: 4, PageSize: 2}},
- []int64{26})
+ []int64{26, 41})
testOrgSuccess(&user_model.SearchUserOptions{ListOptions: db.ListOptions{Page: 5, PageSize: 2}},
[]int64{})
@@ -101,13 +101,13 @@ func TestSearchUsers(t *testing.T) {
}
testUserSuccess(&user_model.SearchUserOptions{OrderBy: "id ASC", ListOptions: db.ListOptions{Page: 1}},
- []int64{1, 2, 4, 5, 8, 9, 10, 11, 12, 13, 14, 15, 16, 18, 20, 21, 24, 27, 28, 29, 30, 32, 34, 37})
+ []int64{1, 2, 4, 5, 8, 9, 10, 11, 12, 13, 14, 15, 16, 18, 20, 21, 24, 27, 28, 29, 30, 32, 34, 37, 38, 39, 40})
testUserSuccess(&user_model.SearchUserOptions{ListOptions: db.ListOptions{Page: 1}, IsActive: util.OptionalBoolFalse},
[]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, 27, 28, 29, 30, 32, 34, 37})
+ []int64{1, 2, 4, 5, 8, 10, 11, 12, 13, 14, 15, 16, 18, 20, 21, 24, 27, 28, 29, 30, 32, 34, 37, 38, 39, 40})
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})