예제 #1
0
def test_template_files(param, result):
    # Arrange
    version = Osversion()

    # Act
    version.template_files = param

    # Assert
    assert version.template_files == result
예제 #2
0
def test_version_file_regex(param, result):
    # Arrange
    version = Osversion()

    # Act
    version.version_file_regex = param

    # Assert
    assert version.version_file_regex == result
예제 #3
0
def test_default_autoinstall(param, result):
    # Arrange
    version = Osversion()

    # Act
    version.default_autoinstall = param

    # Assert
    assert version.default_autoinstall == result
예제 #4
0
def test_kernel_arch(param, result):
    # Arrange
    version = Osversion()

    # Act
    version.kernel_arch = param

    # Assert
    assert version.kernel_arch == result
예제 #5
0
def test_initrd_file(param, result):
    # Arrange
    version = Osversion()

    # Act
    version.initrd_file = param

    # Assert
    assert version.initrd_file == result
예제 #6
0
def test_supported_arches(param, result):
    # Arrange
    osversion = Osversion()

    # Act
    osversion.supported_arches = param

    # Assert
    assert osversion.supported_arches == result
예제 #7
0
def test_kernel_options_post(param, result):
    # Arrange
    version = Osversion()

    # Act
    version.kernel_options_post = param

    # Assert
    assert version.kernel_options_post == result
예제 #8
0
def test_supported_repo_breeds(param, result):
    # Arrange
    osversion = Osversion()

    # Act
    osversion.supported_repo_breeds = param

    # Assert
    assert result
예제 #9
0
def test_isolinux_ok(param, result, raises):
    # Arrange
    version = Osversion()

    # Act
    with raises:
        version.isolinux_ok = param

    # Assert
    assert version.isolinux_ok == result
예제 #10
0
def test_kernel_file(param, result, raises):
    # Arrange
    version = Osversion()

    # Act
    with raises:
        version.kernel_file = param

    # Assert
    assert version.kernel_file == result
예제 #11
0
def test_addosversion():
    # Arrange
    os_signatures = Signatures()
    os_signatures.addosbreed("suse")

    # Act
    os_signatures.addosversion(0, "sles", Osversion())

    # Assert
    assert os_signatures.osbreeds[0].osversions["sles"] == Osversion()
예제 #12
0
def test_boot_loaders(param, result, raises):
    # Arrange
    version = Osversion()

    # Act
    with raises:
        version.boot_loaders = param

    # Assert
    assert version.boot_loaders == result
예제 #13
0
def test_signatures(param, result, raises):
    # Arrange
    version = Osversion()

    # Act
    with raises:
        version.signatures = param

        # Assert
        assert version.signatures == result
예제 #14
0
def test_decode():
    # Arrange
    version = Osversion()
    data = {"version_file": "test"}

    # Act
    version.decode(data)

    # Assert
    assert version.version_file == "test"
예제 #15
0
    def decode(self, data: dict):
        """
        Decodes the received data. Decoding of each single version is done by the corresponding decode method in
        :class:`Osversion`.

        :param data: The data to decode.
        """
        for key in data.keys():
            version = Osversion()
            version.decode(data.get(key))
            self.osversion_add(key, version)
예제 #16
0
def test_encode():
    # Arrange
    version = Osversion()

    # Act
    result = version.encode()

    # Assert
    assert isinstance(result, dict)
    # If we have an empty version, only the bools are shown.
    assert len(result) == 1
예제 #17
0
def test_encode():
    # Arrange
    breed = OsBreed("test")
    breed.osversion_add("test1", Osversion())
    breed.osversion_add("test2", Osversion())

    # Act
    result = breed.encode()

    # Assert
    assert isinstance(result, dict)
    assert "test1" in result
    assert "test2" in result
    assert isinstance(result["test1"], dict)
def test_breed_remove():
    # Arrange
    itemname = "test"
    osbreed = OsBreed(itemname)
    osbreed.osversion_add(itemname, Osversion())

    # Act
    osbreed.osversion_remove(itemname)
예제 #19
0
def test_kernel_arch_del():
    # Arrange
    version = Osversion()

    # Act
    del version.kernel_arch

    # Assert
    assert version.kernel_arch == ""
예제 #20
0
def test_initrd_file_del():
    # Arrange
    version = Osversion()

    # Act
    del version.initrd_file

    # Assert
    assert version.initrd_file == ""
예제 #21
0
def test_version_file_regex_del():
    # Arrange
    version = Osversion()

    # Act
    del version.version_file_regex

    # Assert
    assert version.version_file_regex == ""
예제 #22
0
def test_isolinux_ok_del():
    # Arrange
    version = Osversion()

    # Act
    del version.isolinux_ok

    # Assert
    assert not version.isolinux_ok
예제 #23
0
def test_kernel_options_post_del():
    # Arrange
    version = Osversion()

    # Act
    del version.kernel_options_post

    # Assert
    assert version.kernel_options_post == ""
예제 #24
0
def test_boot_loaders_del():
    # Arrange
    version = Osversion()

    # Act
    del version.boot_loaders

    # Assert
    assert version.boot_loaders == {}
예제 #25
0
def test_default_autoinstall_del():
    # Arrange
    version = Osversion()

    # Act
    del version.default_autoinstall

    # Assert
    assert version.default_autoinstall == ""
예제 #26
0
def test_kernel_file_del():
    # Arrange
    version = Osversion()

    # Act
    del version.kernel_file

    # Assert
    assert version.kernel_file == ""
예제 #27
0
def test_template_files_del():
    # Arrange
    version = Osversion()

    # Act
    del version.template_files

    # Assert
    assert version.template_files == ""
예제 #28
0
def test_signatures_del():
    # Arrange
    version = Osversion()

    # Act
    del version.signatures

    # Assert
    assert version.signatures == set()
예제 #29
0
def test_boot_files_del():
    # Arrange
    version = Osversion()

    # Act
    del version.boot_files

    # Assert
    assert version.boot_files == set()
예제 #30
0
def test_supported_repo_breeds_del():
    # Arrange
    version = Osversion()

    # Act
    del version.supported_repo_breeds

    # Assert
    assert version.supported_repo_breeds == []