mirror of https://github.com/go-gitea/gitea.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
787 B
30 lines
787 B
// Copyright 2025 The Gitea Authors. All rights reserved. |
|
// SPDX-License-Identifier: MIT |
|
|
|
package user |
|
|
|
import ( |
|
"testing" |
|
|
|
"github.com/stretchr/testify/assert" |
|
"github.com/stretchr/testify/require" |
|
) |
|
|
|
func TestSystemUser(t *testing.T) { |
|
u, err := GetPossibleUserByID(t.Context(), -1) |
|
require.NoError(t, err) |
|
assert.Equal(t, "Ghost", u.Name) |
|
assert.Equal(t, "ghost", u.LowerName) |
|
assert.True(t, u.IsGhost()) |
|
assert.True(t, IsGhostUserName("gHost")) |
|
|
|
u, err = GetPossibleUserByID(t.Context(), -2) |
|
require.NoError(t, err) |
|
assert.Equal(t, "gitea-actions", u.Name) |
|
assert.Equal(t, "gitea-actions", u.LowerName) |
|
assert.True(t, u.IsGiteaActions()) |
|
assert.True(t, IsGiteaActionsUserName("Gitea-actionS")) |
|
|
|
_, err = GetPossibleUserByID(t.Context(), -3) |
|
require.Error(t, err) |
|
}
|
|
|