diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2022-08-16 10:22:25 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-16 10:22:25 +0800 |
commit | 86c85c19b625e6ddd99f220a13ee3b5c4cc398e1 (patch) | |
tree | 2545e0c31d5e240b1b168041601c2c24db63bae4 /integrations/api_keys_test.go | |
parent | e3308a092ad00585607089434b2ec5ec4f07c539 (diff) | |
download | gitea-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 'integrations/api_keys_test.go')
-rw-r--r-- | integrations/api_keys_test.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/integrations/api_keys_test.go b/integrations/api_keys_test.go index 198da29b8a..76d1122086 100644 --- a/integrations/api_keys_test.go +++ b/integrations/api_keys_test.go @@ -49,8 +49,8 @@ func TestDeleteDeployKeyNoLogin(t *testing.T) { func TestCreateReadOnlyDeployKey(t *testing.T) { defer prepareTestEnv(t)() - repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{Name: "repo1"}).(*repo_model.Repository) - repoOwner := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: repo.OwnerID}).(*user_model.User) + repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{Name: "repo1"}) + repoOwner := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: repo.OwnerID}) session := loginUser(t, repoOwner.Name) token := getTokenForLoggedInUser(t, session) @@ -75,8 +75,8 @@ func TestCreateReadOnlyDeployKey(t *testing.T) { func TestCreateReadWriteDeployKey(t *testing.T) { defer prepareTestEnv(t)() - repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{Name: "repo1"}).(*repo_model.Repository) - repoOwner := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: repo.OwnerID}).(*user_model.User) + repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{Name: "repo1"}) + repoOwner := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: repo.OwnerID}) session := loginUser(t, repoOwner.Name) token := getTokenForLoggedInUser(t, session) @@ -100,7 +100,7 @@ func TestCreateReadWriteDeployKey(t *testing.T) { func TestCreateUserKey(t *testing.T) { defer prepareTestEnv(t)() - user := unittest.AssertExistsAndLoadBean(t, &user_model.User{Name: "user1"}).(*user_model.User) + user := unittest.AssertExistsAndLoadBean(t, &user_model.User{Name: "user1"}) session := loginUser(t, "user1") token := url.QueryEscape(getTokenForLoggedInUser(t, session)) |