summaryrefslogtreecommitdiffstats
path: root/services/issue/commit_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'services/issue/commit_test.go')
-rw-r--r--services/issue/commit_test.go57
1 files changed, 29 insertions, 28 deletions
diff --git a/services/issue/commit_test.go b/services/issue/commit_test.go
index 37283a7890..ce3f913627 100644
--- a/services/issue/commit_test.go
+++ b/services/issue/commit_test.go
@@ -8,6 +8,7 @@ import (
"testing"
"code.gitea.io/gitea/models"
+ issues_model "code.gitea.io/gitea/models/issues"
repo_model "code.gitea.io/gitea/models/repo"
"code.gitea.io/gitea/models/unittest"
user_model "code.gitea.io/gitea/models/user"
@@ -50,16 +51,16 @@ func TestUpdateIssuesCommit(t *testing.T) {
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 1}).(*repo_model.Repository)
repo.Owner = user
- commentBean := &models.Comment{
- Type: models.CommentTypeCommitRef,
+ commentBean := &issues_model.Comment{
+ Type: issues_model.CommentTypeCommitRef,
CommitSHA: "abcdef1",
PosterID: user.ID,
IssueID: 1,
}
- issueBean := &models.Issue{RepoID: repo.ID, Index: 4}
+ issueBean := &issues_model.Issue{RepoID: repo.ID, Index: 4}
unittest.AssertNotExistsBean(t, commentBean)
- unittest.AssertNotExistsBean(t, &models.Issue{RepoID: repo.ID, Index: 2}, "is_closed=1")
+ unittest.AssertNotExistsBean(t, &issues_model.Issue{RepoID: repo.ID, Index: 2}, "is_closed=1")
assert.NoError(t, UpdateIssuesCommit(user, repo, pushCommits, repo.DefaultBranch))
unittest.AssertExistsAndLoadBean(t, commentBean)
unittest.AssertExistsAndLoadBean(t, issueBean, "is_closed=1")
@@ -77,16 +78,16 @@ func TestUpdateIssuesCommit(t *testing.T) {
},
}
repo = unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 3}).(*repo_model.Repository)
- commentBean = &models.Comment{
- Type: models.CommentTypeCommitRef,
+ commentBean = &issues_model.Comment{
+ Type: issues_model.CommentTypeCommitRef,
CommitSHA: "abcdef1",
PosterID: user.ID,
IssueID: 6,
}
- issueBean = &models.Issue{RepoID: repo.ID, Index: 1}
+ issueBean = &issues_model.Issue{RepoID: repo.ID, Index: 1}
unittest.AssertNotExistsBean(t, commentBean)
- unittest.AssertNotExistsBean(t, &models.Issue{RepoID: repo.ID, Index: 1}, "is_closed=1")
+ unittest.AssertNotExistsBean(t, &issues_model.Issue{RepoID: repo.ID, Index: 1}, "is_closed=1")
assert.NoError(t, UpdateIssuesCommit(user, repo, pushCommits, "non-existing-branch"))
unittest.AssertExistsAndLoadBean(t, commentBean)
unittest.AssertNotExistsBean(t, issueBean, "is_closed=1")
@@ -103,16 +104,16 @@ func TestUpdateIssuesCommit(t *testing.T) {
},
}
repo = unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 3}).(*repo_model.Repository)
- commentBean = &models.Comment{
- Type: models.CommentTypeCommitRef,
+ commentBean = &issues_model.Comment{
+ Type: issues_model.CommentTypeCommitRef,
CommitSHA: "abcdef3",
PosterID: user.ID,
IssueID: 6,
}
- issueBean = &models.Issue{RepoID: repo.ID, Index: 1}
+ issueBean = &issues_model.Issue{RepoID: repo.ID, Index: 1}
unittest.AssertNotExistsBean(t, commentBean)
- unittest.AssertNotExistsBean(t, &models.Issue{RepoID: repo.ID, Index: 1}, "is_closed=1")
+ unittest.AssertNotExistsBean(t, &issues_model.Issue{RepoID: repo.ID, Index: 1}, "is_closed=1")
assert.NoError(t, UpdateIssuesCommit(user, repo, pushCommits, repo.DefaultBranch))
unittest.AssertExistsAndLoadBean(t, commentBean)
unittest.AssertExistsAndLoadBean(t, issueBean, "is_closed=1")
@@ -136,9 +137,9 @@ func TestUpdateIssuesCommit_Colon(t *testing.T) {
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 1}).(*repo_model.Repository)
repo.Owner = user
- issueBean := &models.Issue{RepoID: repo.ID, Index: 4}
+ issueBean := &issues_model.Issue{RepoID: repo.ID, Index: 4}
- unittest.AssertNotExistsBean(t, &models.Issue{RepoID: repo.ID, Index: 2}, "is_closed=1")
+ unittest.AssertNotExistsBean(t, &issues_model.Issue{RepoID: repo.ID, Index: 2}, "is_closed=1")
assert.NoError(t, UpdateIssuesCommit(user, repo, pushCommits, repo.DefaultBranch))
unittest.AssertExistsAndLoadBean(t, issueBean, "is_closed=1")
unittest.CheckConsistencyFor(t, &models.Action{})
@@ -161,14 +162,14 @@ func TestUpdateIssuesCommit_Issue5957(t *testing.T) {
}
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 2}).(*repo_model.Repository)
- commentBean := &models.Comment{
- Type: models.CommentTypeCommitRef,
+ commentBean := &issues_model.Comment{
+ Type: issues_model.CommentTypeCommitRef,
CommitSHA: "abcdef1",
PosterID: user.ID,
IssueID: 7,
}
- issueBean := &models.Issue{RepoID: repo.ID, Index: 2, ID: 7}
+ issueBean := &issues_model.Issue{RepoID: repo.ID, Index: 2, ID: 7}
unittest.AssertNotExistsBean(t, commentBean)
unittest.AssertNotExistsBean(t, issueBean, "is_closed=1")
@@ -196,14 +197,14 @@ func TestUpdateIssuesCommit_AnotherRepo(t *testing.T) {
}
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 2}).(*repo_model.Repository)
- commentBean := &models.Comment{
- Type: models.CommentTypeCommitRef,
+ commentBean := &issues_model.Comment{
+ Type: issues_model.CommentTypeCommitRef,
CommitSHA: "abcdef1",
PosterID: user.ID,
IssueID: 1,
}
- issueBean := &models.Issue{RepoID: 1, Index: 1, ID: 1}
+ issueBean := &issues_model.Issue{RepoID: 1, Index: 1, ID: 1}
unittest.AssertNotExistsBean(t, commentBean)
unittest.AssertNotExistsBean(t, issueBean, "is_closed=1")
@@ -231,14 +232,14 @@ func TestUpdateIssuesCommit_AnotherRepo_FullAddress(t *testing.T) {
}
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 2}).(*repo_model.Repository)
- commentBean := &models.Comment{
- Type: models.CommentTypeCommitRef,
+ commentBean := &issues_model.Comment{
+ Type: issues_model.CommentTypeCommitRef,
CommitSHA: "abcdef1",
PosterID: user.ID,
IssueID: 1,
}
- issueBean := &models.Issue{RepoID: 1, Index: 1, ID: 1}
+ issueBean := &issues_model.Issue{RepoID: 1, Index: 1, ID: 1}
unittest.AssertNotExistsBean(t, commentBean)
unittest.AssertNotExistsBean(t, issueBean, "is_closed=1")
@@ -274,20 +275,20 @@ func TestUpdateIssuesCommit_AnotherRepoNoPermission(t *testing.T) {
}
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 6}).(*repo_model.Repository)
- commentBean := &models.Comment{
- Type: models.CommentTypeCommitRef,
+ commentBean := &issues_model.Comment{
+ Type: issues_model.CommentTypeCommitRef,
CommitSHA: "abcdef3",
PosterID: user.ID,
IssueID: 6,
}
- commentBean2 := &models.Comment{
- Type: models.CommentTypeCommitRef,
+ commentBean2 := &issues_model.Comment{
+ Type: issues_model.CommentTypeCommitRef,
CommitSHA: "abcdef4",
PosterID: user.ID,
IssueID: 6,
}
- issueBean := &models.Issue{RepoID: 3, Index: 1, ID: 6}
+ issueBean := &issues_model.Issue{RepoID: 3, Index: 1, ID: 6}
unittest.AssertNotExistsBean(t, commentBean)
unittest.AssertNotExistsBean(t, commentBean2)