From a666829a37be6f9fd98f9e7dd1767c420f7f3b32 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Wed, 24 Nov 2021 17:49:20 +0800 Subject: Move user related model into models/user (#17781) * Move user related model into models/user * Fix lint for windows * Fix windows lint * Fix windows lint * Move some tests in models * Merge --- integrations/api_issue_tracked_time_test.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'integrations/api_issue_tracked_time_test.go') diff --git a/integrations/api_issue_tracked_time_test.go b/integrations/api_issue_tracked_time_test.go index bcaa0213c8..94e569113c 100644 --- a/integrations/api_issue_tracked_time_test.go +++ b/integrations/api_issue_tracked_time_test.go @@ -12,6 +12,7 @@ import ( "code.gitea.io/gitea/models" "code.gitea.io/gitea/models/unittest" + user_model "code.gitea.io/gitea/models/user" api "code.gitea.io/gitea/modules/structs" "github.com/stretchr/testify/assert" @@ -20,7 +21,7 @@ import ( func TestAPIGetTrackedTimes(t *testing.T) { defer prepareTestEnv(t)() - user2 := unittest.AssertExistsAndLoadBean(t, &models.User{ID: 2}).(*models.User) + user2 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 2}).(*user_model.User) issue2 := unittest.AssertExistsAndLoadBean(t, &models.Issue{ID: 2}).(*models.Issue) assert.NoError(t, issue2.LoadRepo()) @@ -41,7 +42,7 @@ func TestAPIGetTrackedTimes(t *testing.T) { assert.EqualValues(t, issue2.ID, apiTimes[i].IssueID) assert.Equal(t, time.Created.Unix(), apiTimes[i].Created.Unix()) assert.Equal(t, time.Time, apiTimes[i].Time) - user, err := models.GetUserByID(time.UserID) + user, err := user_model.GetUserByID(time.UserID) assert.NoError(t, err) assert.Equal(t, user.Name, apiTimes[i].UserName) } @@ -65,7 +66,7 @@ func TestAPIDeleteTrackedTime(t *testing.T) { time6 := unittest.AssertExistsAndLoadBean(t, &models.TrackedTime{ID: 6}).(*models.TrackedTime) issue2 := unittest.AssertExistsAndLoadBean(t, &models.Issue{ID: 2}).(*models.Issue) assert.NoError(t, issue2.LoadRepo()) - user2 := unittest.AssertExistsAndLoadBean(t, &models.User{ID: 2}).(*models.User) + user2 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 2}).(*user_model.User) session := loginUser(t, user2.Name) token := getTokenForLoggedInUser(t, session) @@ -99,8 +100,8 @@ func TestAPIAddTrackedTimes(t *testing.T) { issue2 := unittest.AssertExistsAndLoadBean(t, &models.Issue{ID: 2}).(*models.Issue) assert.NoError(t, issue2.LoadRepo()) - user2 := unittest.AssertExistsAndLoadBean(t, &models.User{ID: 2}).(*models.User) - admin := unittest.AssertExistsAndLoadBean(t, &models.User{ID: 1}).(*models.User) + user2 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 2}).(*user_model.User) + admin := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 1}).(*user_model.User) session := loginUser(t, admin.Name) token := getTokenForLoggedInUser(t, session) -- cgit v1.2.3