Skip to content

Commit 68079aa

Browse files
committed
fix tests
1 parent 09257f3 commit 68079aa

File tree

3 files changed

+9
-41
lines changed

3 files changed

+9
-41
lines changed

models/action.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -705,17 +705,6 @@ func CommitRepoAction(opts CommitRepoActionOptions) (*CommitRepoEvent, error) {
705705
return &event, nil
706706
}
707707

708-
func transferRepoAction(e Engine, doer, oldOwner *User, repo *Repository) (err error) {
709-
// Remove watch for organization.
710-
if oldOwner.IsOrganization() {
711-
if err = watchRepo(e, oldOwner.ID, repo.ID, false); err != nil {
712-
return fmt.Errorf("watchRepo [false]: %v", err)
713-
}
714-
}
715-
716-
return nil
717-
}
718-
719708
// GetFeedsOptions options for retrieving feeds
720709
type GetFeedsOptions struct {
721710
RequestedUser *User

models/action_test.go

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,8 @@ func TestUpdateIssuesCommit_Issue5957(t *testing.T) {
243243

244244
func testCorrectRepoAction(t *testing.T, opts CommitRepoActionOptions, actionBean *Action) {
245245
AssertNotExistsBean(t, actionBean)
246-
assert.NoError(t, CommitRepoAction(opts))
246+
_, err := CommitRepoAction(opts)
247+
assert.NoError(t, err)
247248
AssertExistsAndLoadBean(t, actionBean)
248249
CheckConsistencyFor(t, &Action{})
249250
}
@@ -354,33 +355,6 @@ func TestCommitRepoAction(t *testing.T) {
354355
}
355356
}
356357

357-
func TestTransferRepoAction(t *testing.T) {
358-
assert.NoError(t, PrepareTestDatabase())
359-
360-
user2 := AssertExistsAndLoadBean(t, &User{ID: 2}).(*User)
361-
user4 := AssertExistsAndLoadBean(t, &User{ID: 4}).(*User)
362-
repo := AssertExistsAndLoadBean(t, &Repository{ID: 1, OwnerID: user2.ID}).(*Repository)
363-
364-
repo.OwnerID = user4.ID
365-
repo.Owner = user4
366-
367-
actionBean := &Action{
368-
OpType: ActionTransferRepo,
369-
ActUserID: user2.ID,
370-
ActUser: user2,
371-
RepoID: repo.ID,
372-
Repo: repo,
373-
IsPrivate: repo.IsPrivate,
374-
}
375-
AssertNotExistsBean(t, actionBean)
376-
assert.NoError(t, TransferRepoAction(user2, user2, repo))
377-
AssertExistsAndLoadBean(t, actionBean)
378-
379-
_, err := x.ID(repo.ID).Cols("owner_id").Update(repo)
380-
assert.NoError(t, err)
381-
CheckConsistencyFor(t, &Action{})
382-
}
383-
384358
func TestGetFeeds(t *testing.T) {
385359
// test with an individual user
386360
assert.NoError(t, PrepareTestDatabase())

models/repo.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1536,8 +1536,13 @@ func TransferOwnership(doer *User, newOwnerName string, repo *Repository) error
15361536

15371537
if err = watchRepo(sess, doer.ID, repo.ID, true); err != nil {
15381538
return fmt.Errorf("watchRepo: %v", err)
1539-
} else if err = transferRepoAction(sess, doer, owner, repo); err != nil {
1540-
return fmt.Errorf("transferRepoAction: %v", err)
1539+
}
1540+
1541+
// Remove watch for organization.
1542+
if owner.IsOrganization() {
1543+
if err = watchRepo(sess, owner.ID, repo.ID, false); err != nil {
1544+
return fmt.Errorf("watchRepo [false]: %v", err)
1545+
}
15411546
}
15421547

15431548
// Rename remote repository to new path and delete local copy.

0 commit comments

Comments
 (0)