Skip to content

Commit 657cf90

Browse files
authored
Merge branch 'main' into deps-api
2 parents 610dc7c + 3ca5dc7 commit 657cf90

File tree

388 files changed

+4551
-3962
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

388 files changed

+4551
-3962
lines changed

cmd/admin.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
"text/tabwriter"
1515

1616
"code.gitea.io/gitea/models"
17+
asymkey_model "code.gitea.io/gitea/models/asymkey"
1718
"code.gitea.io/gitea/models/db"
1819
"code.gitea.io/gitea/models/login"
1920
user_model "code.gitea.io/gitea/models/user"
@@ -625,7 +626,7 @@ func runRegenerateKeys(_ *cli.Context) error {
625626
if err := initDB(ctx); err != nil {
626627
return err
627628
}
628-
return models.RewriteAllPublicKeys()
629+
return asymkey_model.RewriteAllPublicKeys()
629630
}
630631

631632
func parseOAuth2Config(c *cli.Context) *oauth2.Source {

cmd/migrate_storage.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ func migrateAvatars(dstStorage storage.ObjectStorage) error {
102102
}
103103

104104
func migrateRepoAvatars(dstStorage storage.ObjectStorage) error {
105-
return models.IterateRepository(func(repo *models.Repository) error {
105+
return models.IterateRepository(func(repo *repo_model.Repository) error {
106106
_, err := storage.Copy(dstStorage, repo.CustomAvatarRelativePath(), storage.RepoAvatars, repo.CustomAvatarRelativePath())
107107
return err
108108
})

cmd/serv.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
"time"
1818

1919
"code.gitea.io/gitea/models"
20+
asymkey_model "code.gitea.io/gitea/models/asymkey"
2021
"code.gitea.io/gitea/models/perm"
2122
"code.gitea.io/gitea/modules/git"
2223
"code.gitea.io/gitea/modules/json"
@@ -129,9 +130,9 @@ func runServ(c *cli.Context) error {
129130
return fail("Internal error", "Failed to check provided key: %v", err)
130131
}
131132
switch key.Type {
132-
case models.KeyTypeDeploy:
133+
case asymkey_model.KeyTypeDeploy:
133134
println("Hi there! You've successfully authenticated with the deploy key named " + key.Name + ", but Gitea does not provide shell access.")
134-
case models.KeyTypePrincipal:
135+
case asymkey_model.KeyTypePrincipal:
135136
println("Hi there! You've successfully authenticated with the principal " + key.Content + ", but Gitea does not provide shell access.")
136137
default:
137138
println("Hi there, " + user.Name + "! You've successfully authenticated with the key named " + key.Name + ", but Gitea does not provide shell access.")

docs/content/doc/advanced/config-cheat-sheet.en-us.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ The following configuration set `Content-Type: application/vnd.android.package-a
277277
- `SSH_AUTHORIZED_PRINCIPALS_ALLOW`: **off** or **username, email**: \[off, username, email, anything\]: Specify the principals values that users are allowed to use as principal. When set to `anything` no checks are done on the principal string. When set to `off` authorized principal are not allowed to be set.
278278
- `SSH_CREATE_AUTHORIZED_PRINCIPALS_FILE`: **false/true**: Gitea will create a authorized_principals file by default when it is not using the internal ssh server and `SSH_AUTHORIZED_PRINCIPALS_ALLOW` is not `off`.
279279
- `SSH_AUTHORIZED_PRINCIPALS_BACKUP`: **false/true**: Enable SSH Authorized Principals Backup when rewriting all keys, default is true if `SSH_AUTHORIZED_PRINCIPALS_ALLOW` is not `off`.
280-
- `SSH_AUTHORIZED_KEYS_COMMAND_TEMPLATE`: **{{.AppPath}} --config={{.CustomConf}} serv key-{{.Key.ID}}**: Set the template for the command to passed on authorized keys. Possible keys are: AppPath, AppWorkPath, CustomConf, CustomPath, Key - where Key is a `models.PublicKey` and the others are strings which are shellquoted.
280+
- `SSH_AUTHORIZED_KEYS_COMMAND_TEMPLATE`: **{{.AppPath}} --config={{.CustomConf}} serv key-{{.Key.ID}}**: Set the template for the command to passed on authorized keys. Possible keys are: AppPath, AppWorkPath, CustomConf, CustomPath, Key - where Key is a `models/asymkey.PublicKey` and the others are strings which are shellquoted.
281281
- `SSH_SERVER_CIPHERS`: **aes128-ctr, aes192-ctr, aes256-ctr, [email protected], arcfour256, arcfour128**: For the built-in SSH server, choose the ciphers to support for SSH connections, for system SSH this setting has no effect.
282282
- `SSH_SERVER_KEY_EXCHANGES`: **diffie-hellman-group1-sha1, diffie-hellman-group14-sha1, ecdh-sha2-nistp256, ecdh-sha2-nistp384, ecdh-sha2-nistp521, [email protected]**: For the built-in SSH server, choose the key exchange algorithms to support for SSH connections, for system SSH this setting has no effect.
283283
- `SSH_SERVER_MACS`: **[email protected], hmac-sha2-256, hmac-sha1, hmac-sha1-96**: For the built-in SSH server, choose the MACs to support for SSH connections, for system SSH this setting has no effect

integrations/api_admin_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"net/http"
1010
"testing"
1111

12-
"code.gitea.io/gitea/models"
12+
asymkey_model "code.gitea.io/gitea/models/asymkey"
1313
"code.gitea.io/gitea/models/unittest"
1414
user_model "code.gitea.io/gitea/models/user"
1515
"code.gitea.io/gitea/modules/json"
@@ -34,7 +34,7 @@ func TestAPIAdminCreateAndDeleteSSHKey(t *testing.T) {
3434

3535
var newPublicKey api.PublicKey
3636
DecodeJSON(t, resp, &newPublicKey)
37-
unittest.AssertExistsAndLoadBean(t, &models.PublicKey{
37+
unittest.AssertExistsAndLoadBean(t, &asymkey_model.PublicKey{
3838
ID: newPublicKey.ID,
3939
Name: newPublicKey.Title,
4040
Content: newPublicKey.Key,
@@ -45,7 +45,7 @@ func TestAPIAdminCreateAndDeleteSSHKey(t *testing.T) {
4545
req = NewRequestf(t, "DELETE", "/api/v1/admin/users/%s/keys/%d?token=%s",
4646
keyOwner.Name, newPublicKey.ID, token)
4747
session.MakeRequest(t, req, http.StatusNoContent)
48-
unittest.AssertNotExistsBean(t, &models.PublicKey{ID: newPublicKey.ID})
48+
unittest.AssertNotExistsBean(t, &asymkey_model.PublicKey{ID: newPublicKey.ID})
4949
}
5050

5151
func TestAPIAdminDeleteMissingSSHKey(t *testing.T) {

integrations/api_comment_test.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"testing"
1212

1313
"code.gitea.io/gitea/models"
14+
repo_model "code.gitea.io/gitea/models/repo"
1415
"code.gitea.io/gitea/models/unittest"
1516
user_model "code.gitea.io/gitea/models/user"
1617
"code.gitea.io/gitea/modules/convert"
@@ -25,7 +26,7 @@ func TestAPIListRepoComments(t *testing.T) {
2526
comment := unittest.AssertExistsAndLoadBean(t, &models.Comment{},
2627
unittest.Cond("type = ?", models.CommentTypeComment)).(*models.Comment)
2728
issue := unittest.AssertExistsAndLoadBean(t, &models.Issue{ID: comment.IssueID}).(*models.Issue)
28-
repo := unittest.AssertExistsAndLoadBean(t, &models.Repository{ID: issue.RepoID}).(*models.Repository)
29+
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: issue.RepoID}).(*repo_model.Repository)
2930
repoOwner := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: repo.OwnerID}).(*user_model.User)
3031

3132
session := loginUser(t, repoOwner.Name)
@@ -71,7 +72,7 @@ func TestAPIListIssueComments(t *testing.T) {
7172
comment := unittest.AssertExistsAndLoadBean(t, &models.Comment{},
7273
unittest.Cond("type = ?", models.CommentTypeComment)).(*models.Comment)
7374
issue := unittest.AssertExistsAndLoadBean(t, &models.Issue{ID: comment.IssueID}).(*models.Issue)
74-
repo := unittest.AssertExistsAndLoadBean(t, &models.Repository{ID: issue.RepoID}).(*models.Repository)
75+
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: issue.RepoID}).(*repo_model.Repository)
7576
repoOwner := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: repo.OwnerID}).(*user_model.User)
7677

7778
session := loginUser(t, repoOwner.Name)
@@ -91,7 +92,7 @@ func TestAPICreateComment(t *testing.T) {
9192
const commentBody = "Comment body"
9293

9394
issue := unittest.AssertExistsAndLoadBean(t, &models.Issue{}).(*models.Issue)
94-
repo := unittest.AssertExistsAndLoadBean(t, &models.Repository{ID: issue.RepoID}).(*models.Repository)
95+
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: issue.RepoID}).(*repo_model.Repository)
9596
repoOwner := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: repo.OwnerID}).(*user_model.User)
9697

9798
session := loginUser(t, repoOwner.Name)
@@ -114,7 +115,7 @@ func TestAPIGetComment(t *testing.T) {
114115

115116
comment := unittest.AssertExistsAndLoadBean(t, &models.Comment{ID: 2}).(*models.Comment)
116117
assert.NoError(t, comment.LoadIssue())
117-
repo := unittest.AssertExistsAndLoadBean(t, &models.Repository{ID: comment.Issue.RepoID}).(*models.Repository)
118+
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: comment.Issue.RepoID}).(*repo_model.Repository)
118119
repoOwner := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: repo.OwnerID}).(*user_model.User)
119120

120121
session := loginUser(t, repoOwner.Name)
@@ -143,7 +144,7 @@ func TestAPIEditComment(t *testing.T) {
143144
comment := unittest.AssertExistsAndLoadBean(t, &models.Comment{},
144145
unittest.Cond("type = ?", models.CommentTypeComment)).(*models.Comment)
145146
issue := unittest.AssertExistsAndLoadBean(t, &models.Issue{ID: comment.IssueID}).(*models.Issue)
146-
repo := unittest.AssertExistsAndLoadBean(t, &models.Repository{ID: issue.RepoID}).(*models.Repository)
147+
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: issue.RepoID}).(*repo_model.Repository)
147148
repoOwner := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: repo.OwnerID}).(*user_model.User)
148149

149150
session := loginUser(t, repoOwner.Name)
@@ -168,7 +169,7 @@ func TestAPIDeleteComment(t *testing.T) {
168169
comment := unittest.AssertExistsAndLoadBean(t, &models.Comment{},
169170
unittest.Cond("type = ?", models.CommentTypeComment)).(*models.Comment)
170171
issue := unittest.AssertExistsAndLoadBean(t, &models.Issue{ID: comment.IssueID}).(*models.Issue)
171-
repo := unittest.AssertExistsAndLoadBean(t, &models.Repository{ID: issue.RepoID}).(*models.Repository)
172+
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: issue.RepoID}).(*repo_model.Repository)
172173
repoOwner := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: repo.OwnerID}).(*user_model.User)
173174

174175
session := loginUser(t, repoOwner.Name)

integrations/api_helper_for_declarative_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ import (
1313
"testing"
1414
"time"
1515

16-
"code.gitea.io/gitea/models"
1716
"code.gitea.io/gitea/models/perm"
17+
repo_model "code.gitea.io/gitea/models/repo"
1818
"code.gitea.io/gitea/modules/json"
1919
"code.gitea.io/gitea/modules/queue"
2020
api "code.gitea.io/gitea/modules/structs"
@@ -264,7 +264,7 @@ func doAPIMergePullRequest(ctx APITestContext, owner, repo string, index int64)
264264
owner, repo, index, ctx.Token)
265265
req := NewRequestWithJSON(t, http.MethodPost, urlStr, &forms.MergePullRequestForm{
266266
MergeMessageField: "doAPIMergePullRequest Merge",
267-
Do: string(models.MergeStyleMerge),
267+
Do: string(repo_model.MergeStyleMerge),
268268
})
269269

270270
resp := ctx.Session.MakeRequest(t, req, NoExpectedStatus)
@@ -276,7 +276,7 @@ func doAPIMergePullRequest(ctx APITestContext, owner, repo string, index int64)
276276
queue.GetManager().FlushAll(context.Background(), 5*time.Second)
277277
req = NewRequestWithJSON(t, http.MethodPost, urlStr, &forms.MergePullRequestForm{
278278
MergeMessageField: "doAPIMergePullRequest Merge",
279-
Do: string(models.MergeStyleMerge),
279+
Do: string(repo_model.MergeStyleMerge),
280280
})
281281
resp = ctx.Session.MakeRequest(t, req, NoExpectedStatus)
282282
}
@@ -298,7 +298,7 @@ func doAPIManuallyMergePullRequest(ctx APITestContext, owner, repo, commitID str
298298
urlStr := fmt.Sprintf("/api/v1/repos/%s/%s/pulls/%d/merge?token=%s",
299299
owner, repo, index, ctx.Token)
300300
req := NewRequestWithJSON(t, http.MethodPost, urlStr, &forms.MergePullRequestForm{
301-
Do: string(models.MergeStyleManuallyMerged),
301+
Do: string(repo_model.MergeStyleManuallyMerged),
302302
MergeCommitID: commitID,
303303
})
304304

integrations/api_issue_label_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"testing"
1212

1313
"code.gitea.io/gitea/models"
14+
repo_model "code.gitea.io/gitea/models/repo"
1415
"code.gitea.io/gitea/models/unittest"
1516
user_model "code.gitea.io/gitea/models/user"
1617
api "code.gitea.io/gitea/modules/structs"
@@ -21,7 +22,7 @@ import (
2122
func TestAPIModifyLabels(t *testing.T) {
2223
assert.NoError(t, unittest.LoadFixtures())
2324

24-
repo := unittest.AssertExistsAndLoadBean(t, &models.Repository{ID: 2}).(*models.Repository)
25+
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 2}).(*repo_model.Repository)
2526
owner := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: repo.OwnerID}).(*user_model.User)
2627
session := loginUser(t, owner.Name)
2728
token := getTokenForLoggedInUser(t, session)
@@ -91,7 +92,7 @@ func TestAPIModifyLabels(t *testing.T) {
9192
func TestAPIAddIssueLabels(t *testing.T) {
9293
assert.NoError(t, unittest.LoadFixtures())
9394

94-
repo := unittest.AssertExistsAndLoadBean(t, &models.Repository{ID: 1}).(*models.Repository)
95+
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 1}).(*repo_model.Repository)
9596
issue := unittest.AssertExistsAndLoadBean(t, &models.Issue{RepoID: repo.ID}).(*models.Issue)
9697
_ = unittest.AssertExistsAndLoadBean(t, &models.Label{RepoID: repo.ID, ID: 2}).(*models.Label)
9798
owner := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: repo.OwnerID}).(*user_model.User)
@@ -114,7 +115,7 @@ func TestAPIAddIssueLabels(t *testing.T) {
114115
func TestAPIReplaceIssueLabels(t *testing.T) {
115116
assert.NoError(t, unittest.LoadFixtures())
116117

117-
repo := unittest.AssertExistsAndLoadBean(t, &models.Repository{ID: 1}).(*models.Repository)
118+
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 1}).(*repo_model.Repository)
118119
issue := unittest.AssertExistsAndLoadBean(t, &models.Issue{RepoID: repo.ID}).(*models.Issue)
119120
label := unittest.AssertExistsAndLoadBean(t, &models.Label{RepoID: repo.ID}).(*models.Label)
120121
owner := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: repo.OwnerID}).(*user_model.User)
@@ -140,7 +141,7 @@ func TestAPIReplaceIssueLabels(t *testing.T) {
140141
func TestAPIModifyOrgLabels(t *testing.T) {
141142
assert.NoError(t, unittest.LoadFixtures())
142143

143-
repo := unittest.AssertExistsAndLoadBean(t, &models.Repository{ID: 3}).(*models.Repository)
144+
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 3}).(*repo_model.Repository)
144145
owner := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: repo.OwnerID}).(*user_model.User)
145146
user := "user1"
146147
session := loginUser(t, user)

integrations/api_issue_milestone_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"testing"
1111

1212
"code.gitea.io/gitea/models"
13+
repo_model "code.gitea.io/gitea/models/repo"
1314
"code.gitea.io/gitea/models/unittest"
1415
user_model "code.gitea.io/gitea/models/user"
1516
"code.gitea.io/gitea/modules/structs"
@@ -21,7 +22,7 @@ func TestAPIIssuesMilestone(t *testing.T) {
2122
defer prepareTestEnv(t)()
2223

2324
milestone := unittest.AssertExistsAndLoadBean(t, &models.Milestone{ID: 1}).(*models.Milestone)
24-
repo := unittest.AssertExistsAndLoadBean(t, &models.Repository{ID: milestone.RepoID}).(*models.Repository)
25+
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: milestone.RepoID}).(*repo_model.Repository)
2526
owner := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: repo.OwnerID}).(*user_model.User)
2627
assert.Equal(t, int64(1), int64(milestone.NumIssues))
2728
assert.Equal(t, structs.StateOpen, milestone.State())

integrations/api_issue_stopwatch_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"testing"
1010

1111
"code.gitea.io/gitea/models"
12+
repo_model "code.gitea.io/gitea/models/repo"
1213
"code.gitea.io/gitea/models/unittest"
1314
user_model "code.gitea.io/gitea/models/user"
1415
api "code.gitea.io/gitea/modules/structs"
@@ -19,7 +20,7 @@ import (
1920
func TestAPIListStopWatches(t *testing.T) {
2021
defer prepareTestEnv(t)()
2122

22-
repo := unittest.AssertExistsAndLoadBean(t, &models.Repository{ID: 1}).(*models.Repository)
23+
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 1}).(*repo_model.Repository)
2324
owner := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: repo.OwnerID}).(*user_model.User)
2425

2526
session := loginUser(t, owner.Name)

integrations/api_issue_subscription_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"testing"
1111

1212
"code.gitea.io/gitea/models"
13+
repo_model "code.gitea.io/gitea/models/repo"
1314
"code.gitea.io/gitea/models/unittest"
1415
user_model "code.gitea.io/gitea/models/user"
1516
api "code.gitea.io/gitea/modules/structs"
@@ -33,7 +34,7 @@ func TestAPIIssueSubscriptions(t *testing.T) {
3334

3435
testSubscription := func(issue *models.Issue, isWatching bool) {
3536

36-
issueRepo := unittest.AssertExistsAndLoadBean(t, &models.Repository{ID: issue.RepoID}).(*models.Repository)
37+
issueRepo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: issue.RepoID}).(*repo_model.Repository)
3738

3839
urlStr := fmt.Sprintf("/api/v1/repos/%s/%s/issues/%d/subscriptions/check?token=%s", issueRepo.OwnerName, issueRepo.Name, issue.Index, token)
3940
req := NewRequest(t, "GET", urlStr)
@@ -54,7 +55,7 @@ func TestAPIIssueSubscriptions(t *testing.T) {
5455
testSubscription(issue4, false)
5556
testSubscription(issue5, false)
5657

57-
issue1Repo := unittest.AssertExistsAndLoadBean(t, &models.Repository{ID: issue1.RepoID}).(*models.Repository)
58+
issue1Repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: issue1.RepoID}).(*repo_model.Repository)
5859
urlStr := fmt.Sprintf("/api/v1/repos/%s/%s/issues/%d/subscriptions/%s?token=%s", issue1Repo.OwnerName, issue1Repo.Name, issue1.Index, owner.Name, token)
5960
req := NewRequest(t, "DELETE", urlStr)
6061
session.MakeRequest(t, req, http.StatusCreated)
@@ -64,7 +65,7 @@ func TestAPIIssueSubscriptions(t *testing.T) {
6465
session.MakeRequest(t, req, http.StatusOK)
6566
testSubscription(issue1, false)
6667

67-
issue5Repo := unittest.AssertExistsAndLoadBean(t, &models.Repository{ID: issue5.RepoID}).(*models.Repository)
68+
issue5Repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: issue5.RepoID}).(*repo_model.Repository)
6869
urlStr = fmt.Sprintf("/api/v1/repos/%s/%s/issues/%d/subscriptions/%s?token=%s", issue5Repo.OwnerName, issue5Repo.Name, issue5.Index, owner.Name, token)
6970
req = NewRequest(t, "PUT", urlStr)
7071
session.MakeRequest(t, req, http.StatusCreated)

integrations/api_issue_test.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"time"
1313

1414
"code.gitea.io/gitea/models"
15+
repo_model "code.gitea.io/gitea/models/repo"
1516
"code.gitea.io/gitea/models/unittest"
1617
user_model "code.gitea.io/gitea/models/user"
1718
api "code.gitea.io/gitea/modules/structs"
@@ -22,7 +23,7 @@ import (
2223
func TestAPIListIssues(t *testing.T) {
2324
defer prepareTestEnv(t)()
2425

25-
repo := unittest.AssertExistsAndLoadBean(t, &models.Repository{ID: 1}).(*models.Repository)
26+
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 1}).(*repo_model.Repository)
2627
owner := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: repo.OwnerID}).(*user_model.User)
2728

2829
session := loginUser(t, owner.Name)
@@ -73,7 +74,7 @@ func TestAPICreateIssue(t *testing.T) {
7374
defer prepareTestEnv(t)()
7475
const body, title = "apiTestBody", "apiTestTitle"
7576

76-
repoBefore := unittest.AssertExistsAndLoadBean(t, &models.Repository{ID: 1}).(*models.Repository)
77+
repoBefore := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 1}).(*repo_model.Repository)
7778
owner := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: repoBefore.OwnerID}).(*user_model.User)
7879

7980
session := loginUser(t, owner.Name)
@@ -97,7 +98,7 @@ func TestAPICreateIssue(t *testing.T) {
9798
Title: title,
9899
})
99100

100-
repoAfter := unittest.AssertExistsAndLoadBean(t, &models.Repository{ID: 1}).(*models.Repository)
101+
repoAfter := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 1}).(*repo_model.Repository)
101102
assert.Equal(t, repoBefore.NumIssues+1, repoAfter.NumIssues)
102103
assert.Equal(t, repoBefore.NumClosedIssues, repoAfter.NumClosedIssues)
103104
}
@@ -106,7 +107,7 @@ func TestAPIEditIssue(t *testing.T) {
106107
defer prepareTestEnv(t)()
107108

108109
issueBefore := unittest.AssertExistsAndLoadBean(t, &models.Issue{ID: 10}).(*models.Issue)
109-
repoBefore := unittest.AssertExistsAndLoadBean(t, &models.Repository{ID: issueBefore.RepoID}).(*models.Repository)
110+
repoBefore := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: issueBefore.RepoID}).(*repo_model.Repository)
110111
owner := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: repoBefore.OwnerID}).(*user_model.User)
111112
assert.NoError(t, issueBefore.LoadAttributes())
112113
assert.Equal(t, int64(1019307200), int64(issueBefore.DeadlineUnix))
@@ -137,7 +138,7 @@ func TestAPIEditIssue(t *testing.T) {
137138
DecodeJSON(t, resp, &apiIssue)
138139

139140
issueAfter := unittest.AssertExistsAndLoadBean(t, &models.Issue{ID: 10}).(*models.Issue)
140-
repoAfter := unittest.AssertExistsAndLoadBean(t, &models.Repository{ID: issueBefore.RepoID}).(*models.Repository)
141+
repoAfter := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: issueBefore.RepoID}).(*repo_model.Repository)
141142

142143
// check deleted user
143144
assert.Equal(t, int64(500), issueAfter.PosterID)

0 commit comments

Comments
 (0)