MCPcopy
hub / github.com/henrygd/beszel / createTempFile

Function createTempFile

agent/server_test.go:206–218  ·  view source on GitHub ↗

ParseKeys Tests //////////////////////////// Helper function to generate a temporary file with content

(content string)

Source from the content-addressed store, hash-verified

204
205// Helper function to generate a temporary file with content
206func createTempFile(content string) (string, error) {
207 tmpFile, err := os.CreateTemp("", "ssh_keys_*.txt")
208 if err != nil {
209 return "", fmt.Errorf("failed to create temp file: %w", err)
210 }
211 defer tmpFile.Close()
212
213 if _, err := tmpFile.WriteString(content); err != nil {
214 return "", fmt.Errorf("failed to write to temp file: %w", err)
215 }
216
217 return tmpFile.Name(), nil
218}
219
220// Test case 1: String with a single SSH key
221func TestParseSingleKeyFromString(t *testing.T) {

Callers 2

Calls 1

CloseMethod · 0.65

Tested by

no test coverage detected