1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

Move user related model into models/user (#17781)

* Move user related model into models/user

* Fix lint for windows

* Fix windows lint

* Fix windows lint

* Move some tests in models

* Merge
This commit is contained in:
Lunny Xiao
2021-11-24 17:49:20 +08:00
committed by GitHub
parent 4e7ca946da
commit a666829a37
345 changed files with 4230 additions and 3813 deletions

View File

@@ -11,6 +11,7 @@ import (
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/models/unittest"
user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/test"
@@ -105,9 +106,9 @@ func TestCollaborationPost(t *testing.T) {
ctx.Req.Form.Set("collaborator", "user4")
u := &models.User{
u := &user_model.User{
LowerName: "user2",
Type: models.UserTypeIndividual,
Type: user_model.UserTypeIndividual,
}
re := &models.Repository{
@@ -142,7 +143,7 @@ func TestCollaborationPost_InactiveUser(t *testing.T) {
ctx.Req.Form.Set("collaborator", "user9")
repo := &context.Repository{
Owner: &models.User{
Owner: &user_model.User{
LowerName: "user2",
},
}
@@ -165,9 +166,9 @@ func TestCollaborationPost_AddCollaboratorTwice(t *testing.T) {
ctx.Req.Form.Set("collaborator", "user4")
u := &models.User{
u := &user_model.User{
LowerName: "user2",
Type: models.UserTypeIndividual,
Type: user_model.UserTypeIndividual,
}
re := &models.Repository{
@@ -207,7 +208,7 @@ func TestCollaborationPost_NonExistentUser(t *testing.T) {
ctx.Req.Form.Set("collaborator", "user34")
repo := &context.Repository{
Owner: &models.User{
Owner: &user_model.User{
LowerName: "user2",
},
}
@@ -226,9 +227,9 @@ func TestAddTeamPost(t *testing.T) {
ctx.Req.Form.Set("team", "team11")
org := &models.User{
org := &user_model.User{
LowerName: "org26",
Type: models.UserTypeOrganization,
Type: user_model.UserTypeOrganization,
}
team := &models.Team{
@@ -243,7 +244,7 @@ func TestAddTeamPost(t *testing.T) {
}
repo := &context.Repository{
Owner: &models.User{
Owner: &user_model.User{
ID: 26,
LowerName: "org26",
RepoAdminChangeTeamAccess: true,
@@ -266,9 +267,9 @@ func TestAddTeamPost_NotAllowed(t *testing.T) {
ctx.Req.Form.Set("team", "team11")
org := &models.User{
org := &user_model.User{
LowerName: "org26",
Type: models.UserTypeOrganization,
Type: user_model.UserTypeOrganization,
}
team := &models.Team{
@@ -283,7 +284,7 @@ func TestAddTeamPost_NotAllowed(t *testing.T) {
}
repo := &context.Repository{
Owner: &models.User{
Owner: &user_model.User{
ID: 26,
LowerName: "org26",
RepoAdminChangeTeamAccess: false,
@@ -307,9 +308,9 @@ func TestAddTeamPost_AddTeamTwice(t *testing.T) {
ctx.Req.Form.Set("team", "team11")
org := &models.User{
org := &user_model.User{
LowerName: "org26",
Type: models.UserTypeOrganization,
Type: user_model.UserTypeOrganization,
}
team := &models.Team{
@@ -324,7 +325,7 @@ func TestAddTeamPost_AddTeamTwice(t *testing.T) {
}
repo := &context.Repository{
Owner: &models.User{
Owner: &user_model.User{
ID: 26,
LowerName: "org26",
RepoAdminChangeTeamAccess: true,
@@ -348,9 +349,9 @@ func TestAddTeamPost_NonExistentTeam(t *testing.T) {
ctx.Req.Form.Set("team", "team-non-existent")
org := &models.User{
org := &user_model.User{
LowerName: "org26",
Type: models.UserTypeOrganization,
Type: user_model.UserTypeOrganization,
}
re := &models.Repository{
@@ -360,7 +361,7 @@ func TestAddTeamPost_NonExistentTeam(t *testing.T) {
}
repo := &context.Repository{
Owner: &models.User{
Owner: &user_model.User{
ID: 26,
LowerName: "org26",
RepoAdminChangeTeamAccess: true,
@@ -381,9 +382,9 @@ func TestDeleteTeam(t *testing.T) {
ctx.Req.Form.Set("id", "2")
org := &models.User{
org := &user_model.User{
LowerName: "org3",
Type: models.UserTypeOrganization,
Type: user_model.UserTypeOrganization,
}
team := &models.Team{
@@ -398,7 +399,7 @@ func TestDeleteTeam(t *testing.T) {
}
repo := &context.Repository{
Owner: &models.User{
Owner: &user_model.User{
ID: 3,
LowerName: "org3",
RepoAdminChangeTeamAccess: true,