MCPcopy Create free account
hub / github.com/astercloud/aster / TestLocalSandbox_SetSecurityLevel

Function TestLocalSandbox_SetSecurityLevel

pkg/sandbox/local_test.go:603–627  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

601}
602
603func TestLocalSandbox_SetSecurityLevel(t *testing.T) {
604 tmpDir, err := os.MkdirTemp("", "sandbox-test-*")
605 if err != nil {
606 t.Fatalf("failed to create temp dir: %v", err)
607 }
608 defer func() { _ = os.RemoveAll(tmpDir) }()
609
610 sb, err := NewLocalSandbox(&LocalSandboxConfig{
611 WorkDir: tmpDir,
612 SecurityLevel: SecurityLevelBasic,
613 })
614 if err != nil {
615 t.Fatalf("failed to create sandbox: %v", err)
616 }
617
618 if sb.GetSecurityLevel() != SecurityLevelBasic {
619 t.Error("expected SecurityLevelBasic")
620 }
621
622 sb.SetSecurityLevel(SecurityLevelStrict)
623
624 if sb.GetSecurityLevel() != SecurityLevelStrict {
625 t.Error("expected SecurityLevelStrict after setting")
626 }
627}

Callers

nothing calls this directly

Calls 4

GetSecurityLevelMethod · 0.95
SetSecurityLevelMethod · 0.95
NewLocalSandboxFunction · 0.85
ErrorMethod · 0.65

Tested by

no test coverage detected