refactor: implement mocking functions and tests

This commit is contained in:
Patryk Hegenberg 2025-01-15 21:39:17 +01:00
parent 339dba4e13
commit f8ef2ef2d5
21 changed files with 398 additions and 90 deletions

View file

@ -75,7 +75,7 @@ func installFlatpak(os *OS, sudoPassword string) error {
func addFlatpakRemotes(remotes []Remote) error {
for _, remote := range remotes {
cmd := exec.Command("flatpak", "remote-add", "--if-not-exists", remote.Name, remote.URL)
cmd := execCommand("flatpak", "remote-add", "--if-not-exists", remote.Name, remote.URL)
if err := cmd.Run(); err != nil {
return fmt.Errorf("fehler beim Hinzufügen des Remotes %s: %v", remote.Name, err)
}
@ -84,6 +84,6 @@ func addFlatpakRemotes(remotes []Remote) error {
}
func (f *FlatpakManager) InstallPackage(pkg string) error {
cmd := exec.Command("flatpak", "install", "-y", pkg)
cmd := execCommand("flatpak", "install", "-y", pkg)
return cmd.Run()
}