ParseKeys Tests //////////////////////////// Helper function to generate a temporary file with content
(content string)
| 204 | |
| 205 | // Helper function to generate a temporary file with content |
| 206 | func 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 |
| 221 | func TestParseSingleKeyFromString(t *testing.T) { |
no test coverage detected