#!/usr/bin/env bats # Unit tests for encryption-validation.sh hook # Reference: PRD.md FR-001 (Full Disk Encryption) @test "encryption-validation.sh exists and is executable" { [ -f "/workspace/config/hooks/installed/encryption-validation.sh" ] [ -x "/workspace/config/hooks/installed/encryption-validation.sh" ] } @test "Validation checks for LUKS2 format" { grep -q "LUKS\|luks" /workspace/config/hooks/installed/encryption-validation.sh } @test "Validation checks for encryption status" { grep -q "crypt\|Crypt" /workspace/config/hooks/installed/encryption-validation.sh } @test "Validation script uses set -e for error handling" { grep -q "set -e" /workspace/config/hooks/installed/encryption-validation.sh } # ============================================================================= # USERNAME CONSISTENCY (FINDING-008) # ============================================================================= @test "Username 'football' is consistent across all hook files" { # preseed.cfg creates user 'football', hooks should reference same username run grep -r "kneluser" /workspace/config/hooks/ [ "$status" -ne 0 ] } @test "Username in preseed.cfg is 'football'" { grep -q "passwd/username string football" /workspace/config/includes.installer/preseed.cfg } @test "encryption-validation.sh uses correct username 'football'" { # Should NOT reference 'kneluser' ! grep -q "kneluser" /workspace/config/hooks/installed/encryption-validation.sh } @test "usb-automount.sh uses correct username 'football'" { # Should NOT reference 'kneluser' ! grep -q "kneluser" /workspace/config/hooks/live/usb-automount.sh } @test "install-scripts.sh uses correct username 'football'" { # Should NOT reference 'kneluser' ! grep -q "kneluser" /workspace/config/hooks/installed/install-scripts.sh }