diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2019-11-09 04:54:50 +0800 |
---|---|---|
committer | techknowlogick <techknowlogick@gitea.io> | 2019-11-08 15:54:50 -0500 |
commit | 016a5d0438e551d4630819683dd6dc4fccb0cb51 (patch) | |
tree | be5adb9e41fdd3e0b1528cca0c9e111ff81b4eb7 /models/action_test.go | |
parent | fb459f2c2c32dda29870731b6dae1452bbab625f (diff) | |
download | gitea-016a5d0438e551d4630819683dd6dc4fccb0cb51.tar.gz gitea-016a5d0438e551d4630819683dd6dc4fccb0cb51.zip |
Move some actions to notification/action (#8779)
* Move some actions to notification/action
* Fix test
* fix test
Diffstat (limited to 'models/action_test.go')
-rw-r--r-- | models/action_test.go | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/models/action_test.go b/models/action_test.go index df41556850..5eb89aac21 100644 --- a/models/action_test.go +++ b/models/action_test.go @@ -2,7 +2,6 @@ package models import ( "path" - "strings" "testing" "code.gitea.io/gitea/modules/setting" @@ -28,58 +27,6 @@ func TestAction_GetRepoLink(t *testing.T) { assert.Equal(t, expected, action.GetRepoLink()) } -func TestNewRepoAction(t *testing.T) { - assert.NoError(t, PrepareTestDatabase()) - - user := AssertExistsAndLoadBean(t, &User{ID: 2}).(*User) - repo := AssertExistsAndLoadBean(t, &Repository{OwnerID: user.ID}).(*Repository) - repo.Owner = user - - actionBean := &Action{ - OpType: ActionCreateRepo, - ActUserID: user.ID, - RepoID: repo.ID, - ActUser: user, - Repo: repo, - IsPrivate: repo.IsPrivate, - } - - AssertNotExistsBean(t, actionBean) - assert.NoError(t, NewRepoAction(user, repo)) - AssertExistsAndLoadBean(t, actionBean) - CheckConsistencyFor(t, &Action{}) -} - -func TestRenameRepoAction(t *testing.T) { - assert.NoError(t, PrepareTestDatabase()) - - user := AssertExistsAndLoadBean(t, &User{ID: 2}).(*User) - repo := AssertExistsAndLoadBean(t, &Repository{OwnerID: user.ID}).(*Repository) - repo.Owner = user - - oldRepoName := repo.Name - const newRepoName = "newRepoName" - repo.Name = newRepoName - repo.LowerName = strings.ToLower(newRepoName) - - actionBean := &Action{ - OpType: ActionRenameRepo, - ActUserID: user.ID, - ActUser: user, - RepoID: repo.ID, - Repo: repo, - IsPrivate: repo.IsPrivate, - Content: oldRepoName, - } - AssertNotExistsBean(t, actionBean) - assert.NoError(t, RenameRepoAction(user, oldRepoName, repo)) - AssertExistsAndLoadBean(t, actionBean) - - _, err := x.ID(repo.ID).Cols("name", "lower_name").Update(repo) - assert.NoError(t, err) - CheckConsistencyFor(t, &Action{}) -} - func TestPushCommits_ToAPIPayloadCommits(t *testing.T) { pushCommits := NewPushCommits() pushCommits.Commits = []*PushCommit{ |