(path string, content string, mode *int)
| 365 | } |
| 366 | |
| 367 | func (h *testSessionFSHandler) AppendFile(path string, content string, mode *int) error { |
| 368 | fullPath := providerPath(h.root, h.sessionID, path) |
| 369 | if err := os.MkdirAll(filepath.Dir(fullPath), 0o755); err != nil { |
| 370 | return err |
| 371 | } |
| 372 | perm := os.FileMode(0o666) |
| 373 | if mode != nil { |
| 374 | perm = os.FileMode(*mode) |
| 375 | } |
| 376 | f, err := os.OpenFile(fullPath, os.O_CREATE|os.O_WRONLY|os.O_APPEND, perm) |
| 377 | if err != nil { |
| 378 | return err |
| 379 | } |
| 380 | defer f.Close() |
| 381 | _, err = f.WriteString(content) |
| 382 | return err |
| 383 | } |
| 384 | |
| 385 | func (h *testSessionFSHandler) Exists(path string) (bool, error) { |
| 386 | _, err := os.Stat(providerPath(h.root, h.sessionID, path)) |
no test coverage detected