-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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 transfer repository and rename repository on a service package and start action notification #8573
Merged
Merged
Move transfer repository and rename repository on a service package and start action notification #8573
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
90e63f8
move transfer repository and rename repository on a service package a…
lunny 9fe835e
remove unused codes
lunny 6b32640
fix lint
lunny ce94c31
fix bugs
lunny 330cb21
fix test
lunny 61f3b4b
fix test
lunny 292c787
fix test
lunny 2619934
fix lint
lunny c0845cb
update go mod and sum
lunny 2d50c20
Merge branch 'master' into lunny/move_transfer_service
lunny eb1982b
Merge branch 'master' into lunny/move_transfer_service
lunny File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix bugs
- Loading branch information
commit ce94c31882e324f526674c8b552165ef04ab7e83
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright 2019 The Gitea Authors. All rights reserved. | ||
// Use of this source code is governed by a MIT-style | ||
// license that can be found in the LICENSE file. | ||
|
||
package mailer | ||
|
||
import ( | ||
"path/filepath" | ||
"testing" | ||
|
||
"code.gitea.io/gitea/models" | ||
) | ||
|
||
func TestMain(m *testing.M) { | ||
models.MainTest(m, filepath.Join("..", "..")) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright 2019 The Gitea Authors. All rights reserved. | ||
// Use of this source code is governed by a MIT-style | ||
// license that can be found in the LICENSE file. | ||
|
||
package repository | ||
|
||
import ( | ||
"testing" | ||
|
||
"code.gitea.io/gitea/models" | ||
|
||
"github.com/stretchr/testify/assert" | ||
"github.com/unknwon/com" | ||
) | ||
|
||
func TestTransferOwnership(t *testing.T) { | ||
assert.NoError(t, models.PrepareTestDatabase()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @lafriks, This test needs we run |
||
|
||
doer := models.AssertExistsAndLoadBean(t, &models.User{ID: 2}).(*models.User) | ||
repo := models.AssertExistsAndLoadBean(t, &models.Repository{ID: 3}).(*models.Repository) | ||
repo.Owner = models.AssertExistsAndLoadBean(t, &models.User{ID: repo.OwnerID}).(*models.User) | ||
assert.NoError(t, models.TransferOwnership(doer, "user2", repo)) | ||
|
||
transferredRepo := models.AssertExistsAndLoadBean(t, &models.Repository{ID: 3}).(*models.Repository) | ||
assert.EqualValues(t, 2, transferredRepo.OwnerID) | ||
|
||
assert.False(t, com.IsExist(models.RepoPath("user3", "repo3"))) | ||
assert.True(t, com.IsExist(models.RepoPath("user2", "repo3"))) | ||
models.AssertExistsAndLoadBean(t, &models.Action{ | ||
OpType: models.ActionTransferRepo, | ||
ActUserID: 2, | ||
RepoID: 3, | ||
Content: "user3/repo3", | ||
}) | ||
|
||
models.CheckConsistencyFor(t, &models.Repository{}, &models.User{}, &models.Team{}) | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this test is needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because https://github.com/go-gitea/gitea/pull/8573/files#diff-e033c84bd172bdc2d4381884cb7fe41cR27 need this.