aboutsummaryrefslogtreecommitdiffstats
path: root/services/release
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2022-08-16 10:22:25 +0800
committerGitHub <noreply@github.com>2022-08-16 10:22:25 +0800
commit86c85c19b625e6ddd99f220a13ee3b5c4cc398e1 (patch)
tree2545e0c31d5e240b1b168041601c2c24db63bae4 /services/release
parente3308a092ad00585607089434b2ec5ec4f07c539 (diff)
downloadgitea-86c85c19b625e6ddd99f220a13ee3b5c4cc398e1.tar.gz
gitea-86c85c19b625e6ddd99f220a13ee3b5c4cc398e1.zip
Refactor AssertExistsAndLoadBean to use generics (#20797)
* Refactor AssertExistsAndLoadBean to use generics * Fix tests Co-authored-by: zeripath <art27@cantab.net>
Diffstat (limited to 'services/release')
-rw-r--r--services/release/release_test.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/services/release/release_test.go b/services/release/release_test.go
index 0f5b74f70d..d1a9298b69 100644
--- a/services/release/release_test.go
+++ b/services/release/release_test.go
@@ -30,8 +30,8 @@ func TestMain(m *testing.M) {
func TestRelease_Create(t *testing.T) {
assert.NoError(t, unittest.PrepareTestDatabase())
- user := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 2}).(*user_model.User)
- repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 1}).(*repo_model.Repository)
+ user := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 2})
+ repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 1})
repoPath := repo_model.RepoPath(user.Name, repo.Name)
gitRepo, err := git.OpenRepository(git.DefaultContext, repoPath)
@@ -134,8 +134,8 @@ func TestRelease_Create(t *testing.T) {
func TestRelease_Update(t *testing.T) {
assert.NoError(t, unittest.PrepareTestDatabase())
- user := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 2}).(*user_model.User)
- repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 1}).(*repo_model.Repository)
+ user := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 2})
+ repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 1})
repoPath := repo_model.RepoPath(user.Name, repo.Name)
gitRepo, err := git.OpenRepository(git.DefaultContext, repoPath)
@@ -276,8 +276,8 @@ func TestRelease_Update(t *testing.T) {
func TestRelease_createTag(t *testing.T) {
assert.NoError(t, unittest.PrepareTestDatabase())
- user := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 2}).(*user_model.User)
- repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 1}).(*repo_model.Repository)
+ user := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 2})
+ repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 1})
repoPath := repo_model.RepoPath(user.Name, repo.Name)
gitRepo, err := git.OpenRepository(git.DefaultContext, repoPath)
@@ -358,8 +358,8 @@ func TestRelease_createTag(t *testing.T) {
func TestCreateNewTag(t *testing.T) {
assert.NoError(t, unittest.PrepareTestDatabase())
- user := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 2}).(*user_model.User)
- repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 1}).(*repo_model.Repository)
+ user := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 2})
+ repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 1})
assert.NoError(t, CreateNewTag(git.DefaultContext, user, repo, "master", "v2.0",
"v2.0 is released \n\n BUGFIX: .... \n\n 123"))