diff options
Diffstat (limited to 'modules/notification/action/action_test.go')
-rw-r--r-- | modules/notification/action/action_test.go | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/modules/notification/action/action_test.go b/modules/notification/action/action_test.go deleted file mode 100644 index 05ce70f388..0000000000 --- a/modules/notification/action/action_test.go +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2019 The Gitea Authors. All rights reserved. -// SPDX-License-Identifier: MIT - -package action - -import ( - "path/filepath" - "strings" - "testing" - - activities_model "code.gitea.io/gitea/models/activities" - "code.gitea.io/gitea/models/db" - repo_model "code.gitea.io/gitea/models/repo" - "code.gitea.io/gitea/models/unittest" - user_model "code.gitea.io/gitea/models/user" - - "github.com/stretchr/testify/assert" -) - -func TestMain(m *testing.M) { - unittest.MainTest(m, &unittest.TestOptions{ - GiteaRootPath: filepath.Join("..", "..", ".."), - }) -} - -func TestRenameRepoAction(t *testing.T) { - assert.NoError(t, unittest.PrepareTestDatabase()) - - user := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 2}) - repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{OwnerID: user.ID}) - repo.Owner = user - - oldRepoName := repo.Name - const newRepoName = "newRepoName" - repo.Name = newRepoName - repo.LowerName = strings.ToLower(newRepoName) - - actionBean := &activities_model.Action{ - OpType: activities_model.ActionRenameRepo, - ActUserID: user.ID, - ActUser: user, - RepoID: repo.ID, - Repo: repo, - IsPrivate: repo.IsPrivate, - Content: oldRepoName, - } - unittest.AssertNotExistsBean(t, actionBean) - - NewNotifier().NotifyRenameRepository(db.DefaultContext, user, repo, oldRepoName) - - unittest.AssertExistsAndLoadBean(t, actionBean) - unittest.CheckConsistencyFor(t, &activities_model.Action{}) -} |