yao/tools/proc/proc_test.go
Max 7da06a4ae1 feat(search): refactor builtinSearch to utilize websearch tool and enhance context handling
- Updated the builtinSearch function to delegate search operations to the websearch tool, improving modularity and maintainability.
- Enhanced context handling by passing the agent context to builtinSearch, allowing for user and team identification during searches.
- Added a new DecryptValue function in cloud.go to streamline value decryption, delegating to the existing config.DecryptValue method.
- Updated .gitignore to include tools/README.md for better project organization.
2026-05-02 19:58:03 +08:00

39 lines
721 B
Go

package proc
import (
"testing"
)
func TestIsAllowedProcess(t *testing.T) {
allowed := []string{
"models.user.Find",
"schemas.user.Setting",
"stores.cache.Set",
"flows.login.Run",
"scripts.helper.Format",
"services.user.Create",
"tasks.send.Run",
"schedules.cleanup.Run",
"widgets.chart.Data",
}
for _, name := range allowed {
if !isAllowedProcess(name) {
t.Errorf("expected %q to be allowed", name)
}
}
}
func TestIsBlockedProcess(t *testing.T) {
blocked := []string{
"yao.sys.Exec",
"yao.env.Get",
"utils.str.Join",
"tools.websearch",
"unknown.process",
}
for _, name := range blocked {
if isAllowedProcess(name) {
t.Errorf("expected %q to be blocked", name)
}
}
}