Skip to content

Commit a06bed4

Browse files
committed
fix tests
1 parent 6e0a07d commit a06bed4

File tree

2 files changed

+0
-126
lines changed

2 files changed

+0
-126
lines changed

models/action_test.go

Lines changed: 0 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ import (
55
"path"
66
"testing"
77

8-
"code.gitea.io/git"
9-
"code.gitea.io/gitea/modules/notification"
108
"code.gitea.io/gitea/modules/setting"
119

1210
"github.com/stretchr/testify/assert"
@@ -242,121 +240,6 @@ func TestUpdateIssuesCommit_Issue5957(t *testing.T) {
242240
CheckConsistencyFor(t, &Action{})
243241
}
244242

245-
func testCorrectRepoAction(t *testing.T, opts CommitRepoActionOptions, actionBean *Action) {
246-
AssertNotExistsBean(t, actionBean)
247-
evt, err := CommitRepoAction(opts)
248-
notification.NotifyCommitsPushed(evt.Pusher, evt.OpType, evt.Repo, evt.RefName, evt.Data)
249-
assert.NoError(t, err)
250-
AssertExistsAndLoadBean(t, actionBean)
251-
CheckConsistencyFor(t, &Action{})
252-
}
253-
254-
func TestCommitRepoAction(t *testing.T) {
255-
samples := []struct {
256-
userID int64
257-
repositoryID int64
258-
commitRepoActionOptions CommitRepoActionOptions
259-
action Action
260-
}{
261-
{
262-
userID: 2,
263-
repositoryID: 2,
264-
commitRepoActionOptions: CommitRepoActionOptions{
265-
RefFullName: "refName",
266-
OldCommitID: "oldCommitID",
267-
NewCommitID: "newCommitID",
268-
Commits: &PushCommits{
269-
avatars: make(map[string]string),
270-
Commits: []*PushCommit{
271-
{
272-
Sha1: "abcdef1",
273-
CommitterEmail: "[email protected]",
274-
CommitterName: "User Two",
275-
AuthorEmail: "[email protected]",
276-
AuthorName: "User Four",
277-
Message: "message1",
278-
},
279-
{
280-
Sha1: "abcdef2",
281-
CommitterEmail: "[email protected]",
282-
CommitterName: "User Two",
283-
AuthorEmail: "[email protected]",
284-
AuthorName: "User Two",
285-
Message: "message2",
286-
},
287-
},
288-
Len: 2,
289-
},
290-
},
291-
action: Action{
292-
OpType: ActionCommitRepo,
293-
RefName: "refName",
294-
},
295-
},
296-
{
297-
userID: 2,
298-
repositoryID: 1,
299-
commitRepoActionOptions: CommitRepoActionOptions{
300-
RefFullName: git.TagPrefix + "v1.1",
301-
OldCommitID: git.EmptySHA,
302-
NewCommitID: "newCommitID",
303-
Commits: &PushCommits{},
304-
},
305-
action: Action{
306-
OpType: ActionPushTag,
307-
RefName: "v1.1",
308-
},
309-
},
310-
{
311-
userID: 2,
312-
repositoryID: 1,
313-
commitRepoActionOptions: CommitRepoActionOptions{
314-
RefFullName: git.TagPrefix + "v1.1",
315-
OldCommitID: "oldCommitID",
316-
NewCommitID: git.EmptySHA,
317-
Commits: &PushCommits{},
318-
},
319-
action: Action{
320-
OpType: ActionDeleteTag,
321-
RefName: "v1.1",
322-
},
323-
},
324-
{
325-
userID: 2,
326-
repositoryID: 1,
327-
commitRepoActionOptions: CommitRepoActionOptions{
328-
RefFullName: git.BranchPrefix + "feature/1",
329-
OldCommitID: "oldCommitID",
330-
NewCommitID: git.EmptySHA,
331-
Commits: &PushCommits{},
332-
},
333-
action: Action{
334-
OpType: ActionDeleteBranch,
335-
RefName: "feature/1",
336-
},
337-
},
338-
}
339-
340-
for _, s := range samples {
341-
PrepareTestEnv(t)
342-
343-
user := AssertExistsAndLoadBean(t, &User{ID: s.userID}).(*User)
344-
repo := AssertExistsAndLoadBean(t, &Repository{ID: s.repositoryID, OwnerID: user.ID}).(*Repository)
345-
repo.Owner = user
346-
347-
s.commitRepoActionOptions.PusherName = user.Name
348-
s.commitRepoActionOptions.RepoOwnerID = user.ID
349-
s.commitRepoActionOptions.RepoName = repo.Name
350-
351-
s.action.ActUserID = user.ID
352-
s.action.RepoID = repo.ID
353-
s.action.Repo = repo
354-
s.action.IsPrivate = repo.IsPrivate
355-
356-
testCorrectRepoAction(t, s.commitRepoActionOptions, &s.action)
357-
}
358-
}
359-
360243
func TestGetFeeds(t *testing.T) {
361244
// test with an individual user
362245
assert.NoError(t, PrepareTestDatabase())

models/repo_test.go

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

1111
"code.gitea.io/gitea/modules/markup"
12-
"code.gitea.io/gitea/modules/notification"
1312
"code.gitea.io/gitea/modules/setting"
1413

1514
"github.com/Unknwon/com"
@@ -163,19 +162,11 @@ func TestTransferOwnership(t *testing.T) {
163162
repo.Owner = AssertExistsAndLoadBean(t, &User{ID: repo.OwnerID}).(*User)
164163
assert.NoError(t, TransferOwnership(doer, "user2", repo))
165164

166-
notification.NotifyRepositoryTransfered(doer, doer, repo)
167-
168165
transferredRepo := AssertExistsAndLoadBean(t, &Repository{ID: 3}).(*Repository)
169166
assert.EqualValues(t, 2, transferredRepo.OwnerID)
170167

171168
assert.False(t, com.IsExist(RepoPath("user3", "repo3")))
172169
assert.True(t, com.IsExist(RepoPath("user2", "repo3")))
173-
AssertExistsAndLoadBean(t, &Action{
174-
OpType: ActionTransferRepo,
175-
ActUserID: 2,
176-
RepoID: 3,
177-
Content: "user3/repo3",
178-
})
179170

180171
CheckConsistencyFor(t, &Repository{}, &User{}, &Team{})
181172
}

0 commit comments

Comments
 (0)