Files
gotea/services/context/package_test.go
T
lotherk 1b490485ff refactor: import Gotea from Gitea v28.4.0
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
2026-11-22 12:13:09 +00:00

27 lines
738 B
Go

// Copyright 2026 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package context
import (
"testing"
"gotea.dev/models/perm"
"gotea.dev/models/user"
"gotea.dev/modules/structs"
"github.com/stretchr/testify/assert"
)
func TestDeterminePackageAccessModeForLimitedOwner(t *testing.T) {
owner := &user.User{ID: 1, Visibility: structs.VisibleTypeLimited}
accessMode, err := determineAccessMode(&Base{}, owner, &user.User{ID: 2, IsActive: true})
assert.NoError(t, err)
assert.Equal(t, perm.AccessModeRead, accessMode)
accessMode, err = determineAccessMode(&Base{}, owner, &user.User{ID: 3, IsActive: true, IsRestricted: true})
assert.NoError(t, err)
assert.Equal(t, perm.AccessModeNone, accessMode)
}