Repository: cobbler/cobbler

Issue:
Buildiso: `--exclude-dns` has no effect
### Describe the bug

The `--exclude-dns` parameter has no effect during the `cobbler buildiso` command. This means the default case when not using the parameter is wrong. I tried that with `--airgapped`, `--standalone` and `--system=testsystem` with the exact same result.

```bash
cob-srv:/var/cache/cobbler # cobbler distro list
   testdistro
cob-srv:/var/cache/cobbler # cobbler profile list
   testprofile
   testprofile1
   testprofile2
cob-srv:~ # cobbler system list
   testsystem

cob-srv:/var/cache/cobbler # cobbler system report
Name                           : testsystem 
Automatic Installation Template : <<inherit>>
Automatic Installation Template Metadata : <<inherit>>
TFTP Boot Files                : <<inherit>>
Boot loaders                   : <<inherit>>
Comment                        :                                                       
Enable iPXE?                   : <<inherit>>
Fetchable Files                : <<inherit>>
DHCP Filename Override         : <<inherit>>
Gateway                        :   
Hostname                       :      
Image                          : 
IPv6 Autoconfiguration         : False
IPv6 Default Device            : 
Kernel Options                 : <<inherit>>
Kernel Options (Post Install)  : <<inherit>>
Management Classes             : <<inherit>>
Management Parameters          : <<inherit>>
Name Servers                   : ['9.9.9.9']
Name Servers Search Path       : []
Netboot Enabled                : False
Next Server (IPv4) Override    : <<inherit>>
Next Server (IPv6) Override    : <<inherit>>
Owners                         : <<inherit>>
Power Management Address       :      
Power Management ID            : 
Power Identity File            : 
Power Management Options       :      
Power Management Password      :   
Power Management Type          : 
Power Management Username      : 
Profile                        : testprofile
Internal Proxy                 : <<inherit>>
Redhat Management Key          : <<inherit>>
Repos Enabled                  : False
Serial Baud Rate               : -1
Serial Device #                : -1
Server Override                : <<inherit>>
Status                         : 
Template Files                 : {}
Virt Auto Boot                 : <<inherit>>
Virt CPUs                      : <<inherit>>
Virt Disk Driver Type          : <<inherit>>
Virt File Size(GB)             : <<inherit>>
Virt Path                      : <<inherit>>
Virt PXE Boot                  : False
Virt RAM (MB)                  : <<inherit>>
Virt Type                      : <<inherit>>
Interface =====                : default
Bonding Opts                   : 
Bridge Opts                    : 
CNAMES                         : []
InfiniBand Connected Mode      : False
DHCP Tag                       : 
DNS Name                       : 
Per-Interface Gateway          : 
Master Interface               : 
Interface Type                 : NA
IP Address                     : 
IPv6 Address                   : 
IPv6 Default Gateway           : 
IPv6 MTU                       : 
IPv6 Prefix                    : 
IPv6 Secondaries               : []
IPv6 Static Routes             : []
MAC Address                    : 
Management Interface           : False
MTU                            : 
Subnet Mask                    : 
Static                         : False
Static Routes                  : []
Virt Bridge                    : 
```
1. Running buildiso without the `--exclude-dns` parameter
```bash
cob-srv:/var/cache/cobbler # cobbler buildiso --tempdir=/var/cache/cobbler/buildiso --distro=testdistro
task started: 2022-03-15_163321_buildiso
task started (id=Build Iso, time=Tue Mar 15 16:33:21 2022)
running python triggers from /var/lib/cobbler/triggers/task/buildiso/pre/*
running shell triggers from /var/lib/cobbler/triggers/task/buildiso/pre/*
shell triggers finished successfully
Deleting and recreating the buildisodir at "/var/cache/cobbler/buildiso"
building tree for isolinux
building tree for GRUB 2
copying syslinux files
copying: /usr/share/syslinux/isolinux.bin -> /var/cache/cobbler/buildiso/isolinux/isolinux.bin
copying: /usr/share/syslinux/menu.c32 -> /var/cache/cobbler/buildiso/isolinux/menu.c32
copying: /usr/share/syslinux/chain.c32 -> /var/cache/cobbler/buildiso/isolinux/chain.c32
copying GRUB2 files
copying: /var/lib/cobbler/loaders/grub/grubx86.efi -> /var/cache/cobbler/buildiso/grub/grub.efi
Processing profile: "testprofile"
copying kernels and initrds for standalone distro
Processing profile: "testprofile1"
copying kernels and initrds for standalone distro
Processing profile: "testprofile2"
copying kernels and initrds for standalone distro
running: xorriso -as mkisofs  -isohybrid-mbr /usr/share/syslinux/isohdpfx.bin -c isolinux/boot.cat -b isolinux/isolinux.bin -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot -e grub/grub.efi -no-emul-boot -isohybrid-gpt-basdat -V "COBBLER_INSTALL" -o /var/cache/cobbler/generated.iso /var/cache/cobbler/buildiso
received on stdout: 
received on stderr: xorriso 1.4.6 : RockRidge filesystem manipulator, libburnia project.
ISO build complete
You may wish to delete: /var/cache/cobbler/buildiso
The output file is: /var/cache/cobbler/generated.iso
*** TASK COMPLETE ***

cob-srv:/var/cache/cobbler # cat buildiso/isolinux/isolinux.cfg
DEFAULT menu
PROMPT 0
MENU TITLE Cobbler | https://cobbler.github.io
TIMEOUT 200
TOTALTIMEOUT 6000
ONTIMEOUT local

LABEL local
        MENU LABEL (local)
        MENU DEFAULT
        KERNEL chain.c32
        APPEND hd0 0
LABEL testprofile  MENU LABEL testprofile  kernel 1.krn append initrd=1.img install=http://cob-srv.tf.local:80/cblr/links/1 autoyast=http://cob-srv.tf.local:80/cblr/svc/op/autoinstall/profile/testprofileLABEL testprofile1  MENU LABEL testprofile1  kernel 1.krn append initrd=1.img install=http://cob-srv.tf.local:80/cblr/links/1 autoyast=http://cob-srv.tf.local:80/cblr/svc/op/autoinstall/profile/testprofile1LABEL testprofile2  MENU LABEL testprofile2  kernel 1.krn append initrd=1.img install=http://cob-srv.tf.local:80/cblr/links/1 autoyast=http://cob-srv.tf.local:80/cblr/svc/op/autoinstall/profile/testprofile2MENU SEPARATORLABEL testsystem  MENU LABEL testsystem  kernel 1.krn append initrd=1.img install=http://cob-srv.tf.local:80/cblr/links/testdistro autoyast=http://cob-srv.tf.local:80/cblr/svc/op/autoinstall/system/testsystem nameserver=9.9.9.9MENU END
```
2. Running buildiso with the `--exclude-dns` parameter
```bash
cob-srv:/var/cache/cobbler # cobbler buildiso --tempdir=/var/cache/cobbler/buildiso1 --distro=testdistro --exclude-dns
task started: 2022-03-15_163756_buildiso
task started (id=Build Iso, time=Tue Mar 15 16:37:56 2022)
running python triggers from /var/lib/cobbler/triggers/task/buildiso1/pre/*
running shell triggers from /var/lib/cobbler/triggers/task/buildiso1/pre/*
shell triggers finished successfully
Deleting and recreating the buildisodir at "/var/cache/cobbler/buildiso1"
building tree for isolinux
building tree for GRUB 2
copying syslinux files
copying: /usr/share/syslinux/isolinux.bin -> /var/cache/cobbler/buildiso1/isolinux/isolinux.bin
copying: /usr/share/syslinux/menu.c32 -> /var/cache/cobbler/buildiso1/isolinux/menu.c32
copying: /usr/share/syslinux/chain.c32 -> /var/cache/cobbler/buildiso1/isolinux/chain.c32
copying GRUB2 files
copying: /var/lib/cobbler/loaders/grub/grubx86.efi -> /var/cache/cobbler/buildiso1/grub/grub.efi
Processing profile: "testprofile"
copying kernels and initrds for standalone distro
Processing profile: "testprofile1"
copying kernels and initrds for standalone distro
Processing profile: "testprofile2"
copying kernels and initrds for standalone distro
running: xorriso -as mkisofs  -isohybrid-mbr /usr/share/syslinux/isohdpfx.bin -c isolinux/boot.cat -b isolinux/isolinux.bin -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot -e grub/grub.efi -no-emul-boot -isohybrid-gpt-basdat -V "COBBLER_INSTALL" -o /var/cache/cobbler/generated.iso /var/cache/cobbler/buildiso1
received on stdout: 
received on stderr: xorriso 1.4.6 : RockRidge filesystem manipulator, libburnia project.
ISO build complete
You may wish to delete: /var/cache/cobbler/buildiso1
The output file is: /var/cache/cobbler/generated.iso
*** TASK COMPLETE ***

cob-srv:/var/cache/cobbler # cat buildiso/isolinux/isolinux.cfg
DEFAULT menu
PROMPT 0
MENU TITLE Cobbler | https://cobbler.github.io
TIMEOUT 200
TOTALTIMEOUT 6000
ONTIMEOUT local

LABEL local
        MENU LABEL (local)
        MENU DEFAULT
        KERNEL chain.c32
        APPEND hd0 0
LABEL testprofile  MENU LABEL testprofile  kernel 1.krn append initrd=1.img install=http://cob-srv.tf.local:80/cblr/links/1 autoyast=http://cob-srv.tf.local:80/cblr/svc/op/autoinstall/profile/testprofileLABEL testprofile1  MENU LABEL testprofile1  kernel 1.krn append initrd=1.img install=http://cob-srv.tf.local:80/cblr/links/1 autoyast=http://cob-srv.tf.local:80/cblr/svc/op/autoinstall/profile/testprofile1LABEL testprofile2  MENU LABEL testprofile2  kernel 1.krn append initrd=1.img install=http://cob-srv.tf.local:80/cblr/links/1 autoyast=http://cob-srv.tf.local:80/cblr/svc/op/autoinstall/profile/testprofile2MENU SEPARATORLABEL testsystem  MENU LABEL testsystem  kernel 1.krn append initrd=1.img install=http://cob-srv.tf.local:80/cblr/links/testdistro autoyast=http://cob-srv.tf.local:80/cblr/svc/op/autoinstall/system/testsystem nameserver=9.9.9.9MENU END
```

The diff shows no difference between the two files:
 ```bash
cob-srv:/var/cache/cobbler # diff /var/cache/cobbler/buildiso/isolinux/isolinux.cfg /var/cache/cobbler/buildiso1/isolinux/isolinux.cfg 
cob-srv:/var/cache/cobbler # 
```

### Steps to reproduce

1. Run cobbler `buildiso --tempdir=/var/cache/cobbler/buildiso --distro=testdistro --exclude-dns`
2. Run cobbler `buildiso --tempdir=/var/cache/cobbler/buildiso1 --distro=testdistro`
3. Diff both generated `isolinux.cfg` files
4. See no difference in them

### Expected behavior

According to the docs, the `isolinux.cfg` should contain a special entry regarding nameservers.

### Cobbler version


````bash
cobbler version
 Cobbler 3.3.2
  source: ?, ?
  build time: Tue Mar 15 12:00:00 2022
````

### Operating system

```bash
cat /etc/os-release 
NAME="SLES"
VERSION="15-SP4"
VERSION_ID="15.4"
PRETTY_NAME="SUSE Linux Enterprise Server 15 SP4"
ID="sles"
ID_LIKE="suse"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:suse:sles:15:sp4"
DOCUMENTATION_URL="https://documentation.suse.com/"
```

### Cobbler log

<!--- Paste (partial) output from `/var/log/cobbler/cobbler.log` -->
````bash

````


Discussion:

Resolving patch:
diff --git a/cobbler/actions/buildiso/netboot.py b/cobbler/actions/buildiso/netboot.py
--- a/cobbler/actions/buildiso/netboot.py
+++ b/cobbler/actions/buildiso/netboot.py
@@ -93,7 +93,7 @@ def _system_dns_append_line(self, exclude_dns: bool):
         This generates the DNS configuration for the system to boot for the append line.
         :param exclude_dns: If this flag is set to True, the DNS configuration is skipped.
         """
-        if not exclude_dns or self.system_dns is not None:
+        if not exclude_dns and self.system_dns is not None:
             if self.dist.breed == "suse":
                 nameserver_key = "nameserver"
             elif self.dist.breed == "redhat":
@@ -195,7 +195,6 @@ def _generate_static_ip_boot_options(self):
         """
         Try to add static ip boot options to avoid DHCP (interface/ip/netmask/gw/dns)
         Check for overrides first and clear them from kernel_options
-        :return: The Tuple with the interface, IP, Netmask, Gateway and DNS information.
         """
         self._generate_static_ip_boot_interface()
         self._generate_static_ip_boot_ip()


Test patch:
diff --git a/tests/actions/buildiso/__init__.py b/tests/actions/buildiso/__init__.py
new file mode 100644
diff --git a/tests/actions/buildiso/append_line_test.py b/tests/actions/buildiso/append_line_test.py
new file mode 100644
--- /dev/null
+++ b/tests/actions/buildiso/append_line_test.py
@@ -0,0 +1,51 @@
+from cobbler.actions.buildiso.netboot import AppendLineBuilder
+from cobbler import utils
+
+
+def test_init():
+    assert isinstance(AppendLineBuilder("", {}), AppendLineBuilder)
+
+
+def test_generate_system(
+    request, cobbler_api, create_distro, create_profile, create_system
+):
+    # Arrange
+    test_distro = create_distro()
+    test_distro.breed = "suse"
+    cobbler_api.add_distro(test_distro)
+    test_profile = create_profile(test_distro.name)
+    test_system = create_system(profile_name=test_profile.name)
+    blendered_data = utils.blender(cobbler_api, False, test_system)
+    test_builder = AppendLineBuilder(test_distro.name, blendered_data)
+
+    # Act
+    result = test_builder.generate_system(test_distro, test_system, False)
+
+    # Assert
+    # Very basic test yes but this is the expected result atm
+    # TODO: Make tests more sophisticated
+    assert (
+        result
+        == "  APPEND initrd=%s.img install=http://192.168.1.1:80/cblr/links/%s autoyast=default.ks"
+        % (request.node.originalname, request.node.originalname)
+    )
+
+
+def test_generate_profile(request, cobbler_api, create_distro, create_profile):
+    # Arrange
+    test_distro = create_distro()
+    test_profile = create_profile(test_distro.name)
+    blendered_data = utils.blender(cobbler_api, False, test_profile)
+    test_builder = AppendLineBuilder(test_distro.name, blendered_data)
+
+    # Act
+    result = test_builder.generate_profile("suse")
+
+    # Assert
+    # Very basic test yes but this is the expected result atm
+    # TODO: Make tests more sophisticated
+    assert (
+        result
+        == " append initrd=%s.img install=http://192.168.1.1:80/cblr/links/%s autoyast=default.ks"
+        % (request.node.originalname, request.node.originalname)
+    )
diff --git a/tests/actions/buildiso/buildiso_test.py b/tests/actions/buildiso/buildiso_test.py
new file mode 100644
--- /dev/null
+++ b/tests/actions/buildiso/buildiso_test.py
@@ -0,0 +1,164 @@
+import os
+
+import pytest
+
+from cobbler import enums
+from cobbler.actions import buildiso
+from cobbler.actions.buildiso.netboot import NetbootBuildiso
+from cobbler.actions.buildiso.standalone import StandaloneBuildiso
+from tests.conftest import does_not_raise
+
+
+@pytest.mark.parametrize(
+    "input_arch,result_binary_name,expected_exception",
+    [
+        (enums.Archs.X86_64, "grubx64.efi", does_not_raise()),
+        (enums.Archs.PPC, "grub.ppc64le", does_not_raise()),
+        (enums.Archs.PPC64, "grub.ppc64le", does_not_raise()),
+        (enums.Archs.PPC64EL, "grub.ppc64le", does_not_raise()),
+        (enums.Archs.PPC64LE, "grub.ppc64le", does_not_raise()),
+        (enums.Archs.AARCH64, "grubaa64.efi", does_not_raise()),
+        (enums.Archs.ARM, "bootarm.efi", does_not_raise()),
+        (enums.Archs.I386, "bootia32.efi", does_not_raise()),
+        (enums.Archs.IA64, "bootia64.efi", does_not_raise()),
+    ],
+)
+def test_calculate_grub_name(
+    input_arch,
+    result_binary_name,
+    expected_exception,
+    cobbler_api,
+    create_distro,
+):
+    # Arrange
+    test_builder = buildiso.BuildIso(cobbler_api)
+    test_distro = create_distro()
+    test_distro.arch = input_arch
+    cobbler_api.add_distro(test_distro)
+
+    # Act
+    with expected_exception:
+        result = test_builder.calculate_grub_name(test_distro)
+
+        # Assert
+        assert result == result_binary_name
+
+
+@pytest.mark.parametrize(
+    "input_kopts_dict,exepcted_output",
+    [
+        ({}, ""),
+        ({"test": 1}, " test=1"),
+        ({"test": None}, " test"),
+        ({"test": '"test"'}, ' test="test"'),
+        ({"test": "test test test"}, ' test="test test test"'),
+        ({"test": 'test "test" test'}, ' test="test "test" test"'),
+        ({"test": ['"test"']}, ' test="test"'),
+        ({"test": ['"test"', "test"]}, ' test="test" test=test'),
+    ],
+)
+def test_add_remaining_kopts(input_kopts_dict, exepcted_output):
+    # Arrange (missing)
+    # Act
+    output = buildiso.add_remaining_kopts(input_kopts_dict)
+
+    # Assert
+    assert output == exepcted_output
+
+
+def test_make_shorter(cobbler_api):
+    # Arrange
+    build_iso = NetbootBuildiso(cobbler_api)
+    distroname = "Testdistro"
+
+    # Act
+    result = build_iso.make_shorter(distroname)
+
+    # Assert
+    assert type(result) == str
+    assert distroname in build_iso.distmap
+    assert result == "1"
+
+
+def test_copy_boot_files(cobbler_api, create_distro, tmpdir):
+    # Arrange
+    target_folder = tmpdir.mkdir("target")
+    build_iso = buildiso.BuildIso(cobbler_api)
+    testdistro = create_distro()
+
+    # Act
+    build_iso.copy_boot_files(testdistro, target_folder)
+
+    # Assert
+    assert len(os.listdir(target_folder)) == 2
+
+
+def test_filter_system(cobbler_api, create_distro, create_profile, create_system):
+    # Arrange
+    test_distro = create_distro()
+    test_profile = create_profile(test_distro.name)
+    test_system = create_system(profile_name=test_profile.name)
+    itemlist = [test_system.name]
+    build_iso = NetbootBuildiso(cobbler_api)
+    expected_result = [test_system]
+
+    # Act
+    result = build_iso.filter_systems(itemlist)
+
+    # Assert
+    assert expected_result == result
+
+
+def test_filter_profile(cobbler_api, create_distro, create_profile):
+    # Arrange
+    test_distro = create_distro()
+    test_profile = create_profile(test_distro.name)
+    itemlist = [test_profile.name]
+    build_iso = buildiso.BuildIso(cobbler_api)
+    expected_result = [test_profile]
+
+    # Act
+    result = build_iso.filter_profiles(itemlist)
+
+    # Assert
+    assert expected_result == result
+
+
+def test_netboot_run(
+    cobbler_api,
+    create_distro,
+    create_loaders,
+    tmpdir,
+):
+    # Arrange
+    test_distro = create_distro()
+    build_iso = NetbootBuildiso(cobbler_api)
+    iso_location = tmpdir.join("autoinst.iso")
+
+    # Act
+    build_iso.run(iso=str(iso_location), distro_name=test_distro.name)
+
+    # Assert
+    assert iso_location.exists()
+
+
+def test_standalone_run(
+    cobbler_api,
+    create_distro,
+    create_loaders,
+    tmpdir_factory,
+):
+    # Arrange
+    iso_directory = tmpdir_factory.mktemp("isodir")
+    iso_source = tmpdir_factory.mktemp("isosource")
+    iso_location = iso_directory.join("autoinst.iso")
+    test_distro = create_distro()
+    build_iso = StandaloneBuildiso(cobbler_api)
+
+    # Act
+    build_iso.run(
+        iso=str(iso_location), distro_name=test_distro.name, source=str(iso_source)
+    )
+
+    # Assert
+    assert iso_location.exists()
diff --git a/tests/actions/buildiso/conftest.py b/tests/actions/buildiso/conftest.py
new file mode 100644
--- /dev/null
+++ b/tests/actions/buildiso/conftest.py
@@ -0,0 +1,9 @@
+import pytest
+
+from cobbler.actions import mkloaders
+
+
+@pytest.fixture(scope="function", autouse=True)
+def create_loaders(cobbler_api):
+    loaders = mkloaders.MkLoaders(cobbler_api)
+    loaders.run()
diff --git a/tests/actions/buildiso_test.py b/tests/actions/buildiso_test.py
deleted file mode 100644
--- a/tests/actions/buildiso_test.py
+++ /dev/null
@@ -1,313 +0,0 @@
-import os
-
-import pytest
-
-from cobbler import enums, utils
-from cobbler.actions import buildiso, mkloaders
-from cobbler.actions.buildiso.netboot import AppendLineBuilder, NetbootBuildiso
-from cobbler.actions.buildiso.standalone import StandaloneBuildiso
-from cobbler.api import CobblerAPI
-from cobbler.items.distro import Distro
-from cobbler.items.profile import Profile
-from cobbler.items.system import System
-from tests.conftest import does_not_raise
-
-
-@pytest.fixture(scope="class")
-def api():
-    return CobblerAPI()
-
-
-@pytest.fixture(scope="class", autouse=True)
-def create_loaders(api):
-    loaders = mkloaders.MkLoaders(api)
-    loaders.run()
-
-
-@pytest.fixture(autouse=True)
-def cleanup_items(api):
-    yield
-    test_system = api.get_item("system", "testsystem")
-    if test_system is not None:
-        api.remove_system(test_system.name)
-    test_profile = api.get_item("profile", "testprofile")
-    if test_profile is not None:
-        api.remove_profile(test_profile.name)
-    test_distro = api.get_item("distro", "testdistro")
-    if test_distro is not None:
-        api.remove_distro(test_distro.name)
-
-
-class TestBuildiso:
-    """Since BuildIso needs the collection manager and thus the api, as well as other information this test will
-    require greater setup, although only this class shall be tested. Mocks are hard to program and we will try to
-    avoid them.
-    """
-
-    @pytest.mark.parametrize(
-        "input_arch,result_binary_name,expected_exception",
-        [
-            (enums.Archs.X86_64, "grubx64.efi", does_not_raise()),
-            (enums.Archs.PPC, "grub.ppc64le", does_not_raise()),
-            (enums.Archs.PPC64, "grub.ppc64le", does_not_raise()),
-            (enums.Archs.PPC64EL, "grub.ppc64le", does_not_raise()),
-            (enums.Archs.PPC64LE, "grub.ppc64le", does_not_raise()),
-            (enums.Archs.AARCH64, "grubaa64.efi", does_not_raise()),
-            (enums.Archs.ARM, "bootarm.efi", does_not_raise()),
-            (enums.Archs.I386, "bootia32.efi", does_not_raise()),
-            (enums.Archs.IA64, "bootia64.efi", does_not_raise()),
-        ],
-    )
-    def test_calculate_grub_name(
-        self, input_arch, result_binary_name, expected_exception, api
-    ):
-        # Arrange
-        test_builder = buildiso.BuildIso(api)
-        test_distro = Distro(api)
-        test_distro.name = "testdistro"
-        test_distro.arch = input_arch
-
-        # Act
-        with expected_exception:
-            result = test_builder.calculate_grub_name(test_distro)
-
-            # Assert
-            assert result == result_binary_name
-
-    @pytest.mark.parametrize(
-        "input_kopts_dict,exepcted_output",
-        [
-            ({}, ""),
-            ({"test": 1}, " test=1"),
-            ({"test": None}, " test"),
-            ({"test": '"test"'}, ' test="test"'),
-            ({"test": "test test test"}, ' test="test test test"'),
-            ({"test": 'test "test" test'}, ' test="test "test" test"'),
-            ({"test": ['"test"']}, ' test="test"'),
-            ({"test": ['"test"', "test"]}, ' test="test" test=test'),
-        ],
-    )
-    def test_add_remaining_kopts(self, input_kopts_dict, exepcted_output):
-        # Arrange (missing)
-        # Act
-        output = buildiso.add_remaining_kopts(input_kopts_dict)
-
-        # Assert
-        assert output == exepcted_output
-
-    def test_make_shorter(self, api):
-        # Arrange
-        build_iso = NetbootBuildiso(api)
-        distroname = "Testdistro"
-
-        # Act
-        result = build_iso.make_shorter(distroname)
-
-        # Assert
-        assert type(result) == str
-        assert distroname in build_iso.distmap
-        assert result == "1"
-
-    def test_copy_boot_files(
-        self, api, create_kernel_initrd, fk_kernel, fk_initrd, tmpdir
-    ):
-        # Arrange
-        target_folder = tmpdir.mkdir("target")
-        folder = create_kernel_initrd(fk_kernel, fk_initrd)
-        kernel_path = os.path.join(folder, fk_kernel)
-        initrd_path = os.path.join(folder, fk_initrd)
-        build_iso = buildiso.BuildIso(api)
-        testdistro = Distro(api)
-        testdistro.name = "testdistro"
-        testdistro.kernel = kernel_path
-        testdistro.initrd = initrd_path
-
-        # Act
-        build_iso.copy_boot_files(testdistro, target_folder)
-
-        # Assert
-        assert len(os.listdir(target_folder)) == 2
-
-    def test_filter_system(self, api, create_kernel_initrd, fk_kernel, fk_initrd):
-        # Arrange
-        folder = create_kernel_initrd(fk_kernel, fk_initrd)
-        kernel_path = os.path.join(folder, fk_kernel)
-        initrd_path = os.path.join(folder, fk_initrd)
-        test_distro = Distro(api)
-        test_distro.name = "testdistro"
-        test_distro.kernel = kernel_path
-        test_distro.initrd = initrd_path
-        api.add_distro(test_distro)
-        test_profile = Profile(api)
-        test_profile.name = "testprofile"
-        test_profile.distro = test_distro.name
-        api.add_profile(test_profile)
-        test_system = System(api)
-        test_system.name = "testsystem"
-        test_system.profile = test_profile.name
-        api.add_system(test_system)
-        itemlist = [test_system.name]
-        build_iso = NetbootBuildiso(api)
-        expected_result = [test_system]
-
-        # Act
-        result = build_iso.filter_systems(itemlist)
-
-        # Assert
-        assert expected_result == result
-
-    def test_filter_profile(
-        self, api, create_kernel_initrd, fk_kernel, fk_initrd, cleanup_items
-    ):
-        # Arrange
-        folder = create_kernel_initrd(fk_kernel, fk_initrd)
-        kernel_path = os.path.join(folder, fk_kernel)
-        initrd_path = os.path.join(folder, fk_initrd)
-        test_distro = Distro(api)
-        test_distro.name = "testdistro"
-        test_distro.kernel = kernel_path
-        test_distro.initrd = initrd_path
-        api.add_distro(test_distro)
-        test_profile = Profile(api)
-        test_profile.name = "testprofile"
-        test_profile.distro = test_distro.name
-        api.add_profile(test_profile)
-        itemlist = [test_profile.name]
-        build_iso = buildiso.BuildIso(api)
-        expected_result = [test_profile]
-
-        # Act
-        result = build_iso.filter_profiles(itemlist)
-
-        # Assert
-        assert expected_result == result
-
-    def test_netboot_run(
-        self,
-        api,
-        create_kernel_initrd,
-        fk_kernel,
-        fk_initrd,
-        cleanup_items,
-        create_loaders,
-        tmpdir,
-    ):
-        # Arrange
-        folder = create_kernel_initrd(fk_kernel, fk_initrd)
-        kernel_path = os.path.join(folder, fk_kernel)
-        initrd_path = os.path.join(folder, fk_initrd)
-        test_distro = Distro(api)
-        test_distro.name = "testdistro"
-        test_distro.kernel = kernel_path
-        test_distro.initrd = initrd_path
-        api.add_distro(test_distro)
-        build_iso = NetbootBuildiso(api)
-        iso_location = tmpdir.join("autoinst.iso")
-
-        # Act
-        build_iso.run(iso=str(iso_location), distro_name=test_distro.name)
-
-        # Assert
-        assert iso_location.exists()
-
-    def test_standalone_run(
-        self,
-        api,
-        create_kernel_initrd,
-        fk_kernel,
-        fk_initrd,
-        create_loaders,
-        tmpdir_factory,
-        cleanup_items,
-    ):
-        # Arrange
-        iso_directory = tmpdir_factory.mktemp("isodir")
-        iso_source = tmpdir_factory.mktemp("isosource")
-        iso_location = iso_directory.join("autoinst.iso")
-        folder = create_kernel_initrd(fk_kernel, fk_initrd)
-        kernel_path = os.path.join(folder, fk_kernel)
-        initrd_path = os.path.join(folder, fk_initrd)
-        test_distro = Distro(api)
-        test_distro.name = "testdistro"
-        test_distro.kernel = kernel_path
-        test_distro.initrd = initrd_path
-        api.add_distro(test_distro)
-        build_iso = StandaloneBuildiso(api)
-
-        # Act
-        build_iso.run(
-            iso=str(iso_location), distro_name=test_distro.name, source=str(iso_source)
-        )
-
-        # Assert
-        assert iso_location.exists()
-
-
-class TestAppendLineBuilder:
-    def test_init(self):
-        assert isinstance(AppendLineBuilder("", {}), AppendLineBuilder)
-
-    def test_generate_system(
-        self, api, create_kernel_initrd, fk_kernel, fk_initrd, cleanup_items
-    ):
-        # Arrange
-        folder = create_kernel_initrd(fk_kernel, fk_initrd)
-        kernel_path = os.path.join(folder, fk_kernel)
-        initrd_path = os.path.join(folder, fk_initrd)
-        test_distro = Distro(api)
-        test_distro.name = "testdistro"
-        test_distro.breed = "suse"
-        test_distro.kernel = kernel_path
-        test_distro.initrd = initrd_path
-        api.add_distro(test_distro)
-        test_profile = Profile(api)
-        test_profile.name = "testprofile"
-        test_profile.distro = test_distro.name
-        api.add_profile(test_profile)
-        test_system = System(api)
-        test_system.name = "testsystem"
-        test_system.profile = test_profile.name
-        api.add_system(test_system)
-        blendered_data = utils.blender(api, False, test_system)
-        test_builder = AppendLineBuilder(test_distro.name, blendered_data)
-
-        # Act
-        result = test_builder.generate_system(test_distro, test_system, False)
-
-        # Assert
-        # Very basic test yes but this is the expected result atm
-        # TODO: Make tests more sophisticated
-        assert (
-            result
-            == "  APPEND initrd=testdistro.img install=http://192.168.1.1:80/cblr/links/testdistro autoyast=default.ks"
-        )
-
-    def test_generate_profile(
-        self, api, create_kernel_initrd, fk_kernel, fk_initrd, cleanup_items
-    ):
-        # Arrange
-        folder = create_kernel_initrd(fk_kernel, fk_initrd)
-        kernel_path = os.path.join(folder, fk_kernel)
-        initrd_path = os.path.join(folder, fk_initrd)
-        test_distro = Distro(api)
-        test_distro.name = "testdistro"
-        test_distro.kernel = kernel_path
-        test_distro.initrd = initrd_path
-        api.add_distro(test_distro)
-        test_profile = Profile(api)
-        test_profile.name = "testprofile"
-        test_profile.distro = test_distro.name
-        api.add_profile(test_profile)
-        blendered_data = utils.blender(api, False, test_profile)
-        test_builder = AppendLineBuilder(test_distro.name, blendered_data)
-
-        # Act
-        result = test_builder.generate_profile("suse")
-
-        # Assert
-        # Very basic test yes but this is the expected result atm
-        # TODO: Make tests more sophisticated
-        assert (
-            result
-            == " append initrd=testdistro.img install=http://192.168.1.1:80/cblr/links/testdistro autoyast=default.ks"
-        )