Rename the main module to gotea.dev and the binary to gotea, and update the application name and English locale. Keep the external gitea.dev/sdk and gitea.dev/actionslib module imports unchanged. Assisted-by: OpenCode:DeepSeek-V4.1-Flash
26 lines
633 B
Go
26 lines
633 B
Go
// Copyright 2026 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package v1
|
|
|
|
import (
|
|
"testing"
|
|
|
|
user_model "gotea.dev/models/user"
|
|
"gotea.dev/modules/setting"
|
|
"gotea.dev/modules/test"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestDoerNeedTwoFactorAuth(t *testing.T) {
|
|
defer test.MockVariableValue(&setting.TwoFactorAuthEnforced, true)()
|
|
|
|
for _, doer := range []*user_model.User{nil, user_model.NewActionsUser(), user_model.NewDeployKeyUser()} {
|
|
need, err := doerNeedTwoFactorAuth(t.Context(), doer)
|
|
require.NoError(t, err)
|
|
assert.False(t, need)
|
|
}
|
|
}
|