Files
LocalAI/core/application/addon_admin_test.go
T
Ettore Di Giacinto c24de4fc21 test(addons): move the remaining add-on tests to Ginkgo
The built-in catalog, tool arguments, loopback carrier, host operation
contract, packaging, application, config, CLI and endpoint tests used
the testing package calls that forbidigo rejects. They now run as Ginkgo
specs. The endpoint tests also drop the unchecked Close errors that
errcheck reports when the auth tag is on.

Assisted-by: Claude Code:claude-sonnet-5-5 go
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
2026-10-21 02:20:12 +00:00

21 lines
735 B
Go

// SPDX-License-Identifier: MIT
package application
import (
"github.com/mudler/LocalAI/pkg/addons/contract"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
// Without an account database the local owner is the administrator, and no
// other actor is.
var _ = Describe("the admin check without an account database", func() {
It("trusts only the local owner", func() {
check := addonAdminCheck(nil)
Expect(check(contract.Actor{UserID: "local-owner", Mode: "local-owner"})).To(BeTrue(),
"the local owner is not the administrator without an account database")
Expect(check(contract.Actor{UserID: "u1", Mode: "named-user"})).To(BeFalse(),
"a named user is an administrator without an account database")
})
})