MCPcopy Index your code
hub / github.com/larksuite/cli / TestAssertSecurePath_NonAbsolutePath

Function TestAssertSecurePath_NonAbsolutePath

internal/binding/audit_test.go:15–28  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

13)
14
15func TestAssertSecurePath_NonAbsolutePath(t *testing.T) {
16 _, err := AssertSecurePath(AuditParams{
17 TargetPath: "relative/path.txt",
18 Label: "test",
19 AllowInsecurePath: true,
20 })
21 if err == nil {
22 t.Fatal("expected error for non-absolute path, got nil")
23 }
24 want := fmt.Sprintf("test: path must be absolute, got %q", "relative/path.txt")
25 if err.Error() != want {
26 t.Errorf("error = %q, want %q", err.Error(), want)
27 }
28}
29
30func TestAssertSecurePath_FileDoesNotExist(t *testing.T) {
31 nonexistent := filepath.Join(t.TempDir(), "nonexistent.txt")

Callers

nothing calls this directly

Calls 2

AssertSecurePathFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected