- 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.
39 lines
721 B
Go
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)
|
|
}
|
|
}
|
|
}
|