Files
miasma-alis-installer/main_test.go
2025-11-12 18:34:08 +11:00

43 lines
905 B
Go

package main
import (
"os"
"testing"
)
func TestMiasmaInstallerCreation(t *testing.T) {
installer := NewMiasmaInstaller()
if installer == nil {
t.Error("NewMiasmaInstaller() should not return nil")
}
if !installer.installHardened {
t.Error("installHardened should be true by default")
}
if len(installer.installPackages) != 0 {
t.Error("installPackages should be empty by default")
}
}
func TestCreateTempConfig(t *testing.T) {
installer := NewMiasmaInstaller()
installer.device = "/dev/sda"
installer.username = "testuser"
installer.password = "testpassword"
// Create temporary config file
err := installer.createTempConfig()
if err != nil {
t.Errorf("createTempConfig() failed: %v", err)
}
// Check if file was created
if _, err := os.Stat("alis.conf"); os.IsNotExist(err) {
t.Error("alis.conf file was not created")
}
// Clean up
os.Remove("alis.conf")
}