forked from NYANDEV/forgejo
[Refactor] Move APIFormat functions into convert package (#12856)
* USER APIFormat -> ToUser * Migrate more and mark APIFormat deprecated * models.Comment APIFormat() -> convert.ToComment * models.Release APIFormat() -> convert.ToRelease * models.Attachments APIFormat() -> convert.ToReleaseAttachments * models.CommitStatus APIFormat() -> convert.ToCommitStatus * finish migration to convert.ToUser * Move Test * Imprufe Test * fix test Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
parent
131278ff22
commit
d453533beb
28 changed files with 234 additions and 208 deletions
|
@ -78,23 +78,6 @@ func TestGetUserEmailsByNames(t *testing.T) {
|
|||
assert.Equal(t, []string{"user8@example.com"}, GetUserEmailsByNames([]string{"user8", "user7"}))
|
||||
}
|
||||
|
||||
func TestUser_APIFormat(t *testing.T) {
|
||||
|
||||
user, err := GetUserByID(1)
|
||||
assert.NoError(t, err)
|
||||
assert.True(t, user.IsAdmin)
|
||||
|
||||
apiUser := user.APIFormat()
|
||||
assert.True(t, apiUser.IsAdmin)
|
||||
|
||||
user, err = GetUserByID(2)
|
||||
assert.NoError(t, err)
|
||||
assert.False(t, user.IsAdmin)
|
||||
|
||||
apiUser = user.APIFormat()
|
||||
assert.False(t, apiUser.IsAdmin)
|
||||
}
|
||||
|
||||
func TestCanCreateOrganization(t *testing.T) {
|
||||
assert.NoError(t, PrepareTestDatabase())
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue