Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move push commits from models to modules/repository #9370

Merged
merged 9 commits into from
Jan 10, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix test
  • Loading branch information
lunny committed Jan 2, 2020
commit 54b58d2570aa059339ff68fbbe689daa4f962e37
23 changes: 12 additions & 11 deletions modules/repofiles/action_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/repository"

"github.com/stretchr/testify/assert"
)
Expand All @@ -34,8 +35,8 @@ func TestCommitRepoAction(t *testing.T) {
RefFullName: "refName",
OldCommitID: "oldCommitID",
NewCommitID: "newCommitID",
Commits: &models.PushCommits{
Commits: []*models.PushCommit{
Commits: &repository.PushCommits{
Commits: []*repository.PushCommit{
{
Sha1: "69554a6",
CommitterEmail: "[email protected]",
Expand Down Expand Up @@ -68,7 +69,7 @@ func TestCommitRepoAction(t *testing.T) {
RefFullName: git.TagPrefix + "v1.1",
OldCommitID: git.EmptySHA,
NewCommitID: "newCommitID",
Commits: &models.PushCommits{},
Commits: &repository.PushCommits{},
},
action: models.Action{
OpType: models.ActionPushTag,
Expand All @@ -82,7 +83,7 @@ func TestCommitRepoAction(t *testing.T) {
RefFullName: git.TagPrefix + "v1.1",
OldCommitID: "oldCommitID",
NewCommitID: git.EmptySHA,
Commits: &models.PushCommits{},
Commits: &repository.PushCommits{},
},
action: models.Action{
OpType: models.ActionDeleteTag,
Expand All @@ -96,7 +97,7 @@ func TestCommitRepoAction(t *testing.T) {
RefFullName: git.BranchPrefix + "feature/1",
OldCommitID: "oldCommitID",
NewCommitID: git.EmptySHA,
Commits: &models.PushCommits{},
Commits: &repository.PushCommits{},
},
action: models.Action{
OpType: models.ActionDeleteBranch,
Expand Down Expand Up @@ -127,7 +128,7 @@ func TestCommitRepoAction(t *testing.T) {

func TestUpdateIssuesCommit(t *testing.T) {
assert.NoError(t, models.PrepareTestDatabase())
pushCommits := []*models.PushCommit{
pushCommits := []*repository.PushCommit{
{
Sha1: "abcdef1",
CommitterEmail: "[email protected]",
Expand Down Expand Up @@ -174,7 +175,7 @@ func TestUpdateIssuesCommit(t *testing.T) {
models.CheckConsistencyFor(t, &models.Action{})

// Test that push to a non-default branch closes no issue.
pushCommits = []*models.PushCommit{
pushCommits = []*repository.PushCommit{
{
Sha1: "abcdef1",
CommitterEmail: "[email protected]",
Expand Down Expand Up @@ -203,7 +204,7 @@ func TestUpdateIssuesCommit(t *testing.T) {

func TestUpdateIssuesCommit_Colon(t *testing.T) {
assert.NoError(t, models.PrepareTestDatabase())
pushCommits := []*models.PushCommit{
pushCommits := []*repository.PushCommit{
{
Sha1: "abcdef2",
CommitterEmail: "[email protected]",
Expand Down Expand Up @@ -231,7 +232,7 @@ func TestUpdateIssuesCommit_Issue5957(t *testing.T) {
user := models.AssertExistsAndLoadBean(t, &models.User{ID: 2}).(*models.User)

// Test that push to a non-default branch closes an issue.
pushCommits := []*models.PushCommit{
pushCommits := []*repository.PushCommit{
{
Sha1: "abcdef1",
CommitterEmail: "[email protected]",
Expand Down Expand Up @@ -266,7 +267,7 @@ func TestUpdateIssuesCommit_AnotherRepo(t *testing.T) {

// Test that a push to default branch closes issue in another repo
// If the user also has push permissions to that repo
pushCommits := []*models.PushCommit{
pushCommits := []*repository.PushCommit{
{
Sha1: "abcdef1",
CommitterEmail: "[email protected]",
Expand Down Expand Up @@ -301,7 +302,7 @@ func TestUpdateIssuesCommit_AnotherRepoNoPermission(t *testing.T) {

// Test that a push with close reference *can not* close issue
// If the commiter doesn't have push rights in that repo
pushCommits := []*models.PushCommit{
pushCommits := []*repository.PushCommit{
{
Sha1: "abcdef3",
CommitterEmail: "[email protected]",
Expand Down