initial commit
This commit is contained in:
43
main_test.go
Normal file
43
main_test.go
Normal file
@@ -0,0 +1,43 @@
|
||||
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")
|
||||
}
|
||||
Reference in New Issue
Block a user