summaryrefslogtreecommitdiffstats
path: root/integrations/api_notification_test.go
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 /integrations/api_notification_test.go
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 'integrations/api_notification_test.go')
-rw-r--r--integrations/api_notification_test.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/integrations/api_notification_test.go b/integrations/api_notification_test.go
index 4bf18632ca..ad6a8af0a5 100644
--- a/integrations/api_notification_test.go
+++ b/integrations/api_notification_test.go
@@ -21,9 +21,9 @@ import (
func TestAPINotification(t *testing.T) {
defer prepareTestEnv(t)()
- user2 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 2}).(*user_model.User)
- repo1 := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 1}).(*repo_model.Repository)
- thread5 := unittest.AssertExistsAndLoadBean(t, &models.Notification{ID: 5}).(*models.Notification)
+ user2 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 2})
+ repo1 := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 1})
+ thread5 := unittest.AssertExistsAndLoadBean(t, &models.Notification{ID: 5})
assert.NoError(t, thread5.LoadAttributes())
session := loginUser(t, user2.Name)
token := getTokenForLoggedInUser(t, session)
@@ -127,7 +127,7 @@ func TestAPINotification(t *testing.T) {
session.MakeRequest(t, req, http.StatusResetContent)
assert.Equal(t, models.NotificationStatusUnread, thread5.Status)
- thread5 = unittest.AssertExistsAndLoadBean(t, &models.Notification{ID: 5}).(*models.Notification)
+ thread5 = unittest.AssertExistsAndLoadBean(t, &models.Notification{ID: 5})
assert.Equal(t, models.NotificationStatusRead, thread5.Status)
// -- check notifications --
@@ -140,8 +140,8 @@ func TestAPINotification(t *testing.T) {
func TestAPINotificationPUT(t *testing.T) {
defer prepareTestEnv(t)()
- user2 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 2}).(*user_model.User)
- thread5 := unittest.AssertExistsAndLoadBean(t, &models.Notification{ID: 5}).(*models.Notification)
+ user2 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 2})
+ thread5 := unittest.AssertExistsAndLoadBean(t, &models.Notification{ID: 5})
assert.NoError(t, thread5.LoadAttributes())
session := loginUser(t, user2.Name)
token := getTokenForLoggedInUser(t, session)