Esempio n. 1
0
    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
Esempio n. 2
0
    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
Esempio n. 3
0
 def build_iso(self,
               iso=None,
               profiles=None,
               systems=None,
               buildisodir=None,
               distro=None,
               standalone=None,
               airgapped=None,
               source=None,
               exclude_dns=None,
               mkisofs_opts=None,
               logger=None):
     builder = buildiso.BuildIso(self._collection_mgr, logger=logger)
     builder.run(iso=iso,
                 profiles=profiles,
                 systems=systems,
                 buildisodir=buildisodir,
                 distro=distro,
                 standalone=standalone,
                 airgapped=airgapped,
                 source=source,
                 exclude_dns=exclude_dns,
                 mkisofs_opts=mkisofs_opts)
Esempio n. 4
0
    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