コード例 #1
0
def test_supported_boot_loaders():
    # Arrange
    test_api = CobblerAPI()
    image = Image(test_api)

    # Act & Assert
    assert image.supported_boot_loaders == []
コード例 #2
0
def test_object_creation():
    # Arrange
    test_api = CobblerAPI()

    # Act
    image = Image(test_api)

    # Arrange
    assert isinstance(image, Image)
コード例 #3
0
def test_autoinstall():
    # Arrange
    test_api = CobblerAPI()
    image = Image(test_api)

    # Act
    image.autoinstall = ""

    # Assert
    assert image.autoinstall == ""
コード例 #4
0
def test_arch():
    # Arrange
    test_api = CobblerAPI()
    image = Image(test_api)

    # Act
    image.arch = "x86_64"

    # Assert
    assert image.arch == enums.Archs.X86_64
コード例 #5
0
def test_boot_loaders():
    # Arrange
    test_api = CobblerAPI()
    image = Image(test_api)

    # Act
    image.boot_loaders = ""

    # Assert
    assert image.boot_loaders == []
コード例 #6
0
def test_virt_path():
    # Arrange
    test_api = CobblerAPI()
    image = Image(test_api)

    # Act
    image.virt_path = ""

    # Assert
    assert image.virt_path == ""
コード例 #7
0
def test_network_count():
    # Arrange
    test_api = CobblerAPI()
    image = Image(test_api)

    # Act
    image.network_count = 2

    # Assert
    assert image.network_count == 2
コード例 #8
0
def test_virt_type():
    # Arrange
    test_api = CobblerAPI()
    image = Image(test_api)

    # Act
    image.virt_type = enums.VirtType.AUTO

    # Assert
    assert image.virt_type == enums.VirtType.AUTO
コード例 #9
0
def test_virt_bridge():
    # Arrange
    test_api = CobblerAPI()
    image = Image(test_api)

    # Act
    image.virt_bridge = "testbridge"

    # Assert
    assert image.virt_bridge == "testbridge"
コード例 #10
0
def test_make_clone():
    # Arrange
    test_api = CobblerAPI()
    image = Image(test_api)

    # Act
    result = image.make_clone()

    # Assert
    assert image != result
コード例 #11
0
def test_virt_ram():
    # Arrange
    test_api = CobblerAPI()
    image = Image(test_api)

    # Act
    image.virt_ram = 5

    # Assert
    assert image.virt_ram == 5
コード例 #12
0
def test_virt_disk_driver():
    # Arrange
    test_api = CobblerAPI()
    image = Image(test_api)

    # Act
    image.virt_disk_driver = enums.VirtDiskDrivers.RAW

    # Assert
    assert image.virt_disk_driver == enums.VirtDiskDrivers.RAW
コード例 #13
0
def test_virt_file_size():
    # Arrange
    test_api = CobblerAPI()
    image = Image(test_api)

    # Act
    image.virt_file_size = 500

    # Assert
    assert image.virt_file_size == 500
コード例 #14
0
def test_virt_auto_boot():
    # Arrange
    test_api = CobblerAPI()
    image = Image(test_api)

    # Act
    image.virt_auto_boot = False

    # Assert
    assert not image.virt_auto_boot
コード例 #15
0
def test_file():
    # Arrange
    test_api = CobblerAPI()
    image = Image(test_api)

    # Act
    image.file = ""

    # Assert
    assert image.file == ""
コード例 #16
0
def test_menu():
    # Arrange
    test_api = CobblerAPI()
    image = Image(test_api)

    # Act
    image.menu = ""

    # Assert
    assert image.menu == ""
コード例 #17
0
def test_image_type():
    # Arrange
    test_api = CobblerAPI()
    image = Image(test_api)

    # Act
    image.image_type = enums.ImageTypes.DIRECT

    # Assert
    assert image.image_type == enums.ImageTypes.DIRECT
コード例 #18
0
def test_breed():
    # Arrange
    test_api = CobblerAPI()
    utils.load_signatures("/var/lib/cobbler/distro_signatures.json")
    image = Image(test_api)

    # Act
    image.breed = "suse"

    # Assert
    assert image.breed == "suse"
コード例 #19
0
def test_os_version():
    # Arrange
    test_api = CobblerAPI()
    utils.load_signatures("/var/lib/cobbler/distro_signatures.json")
    image = Image(test_api)
    image.breed = "suse"

    # Act
    image.os_version = "sles15generic"

    # Assert
    assert image.os_version == "sles15generic"
コード例 #20
0
def test_image_rename():
    # Arrange
    test_api = CobblerAPI()
    testimage = Image(test_api)
    testimage.name = "myimage"
    test_api.add_image(testimage, save=False)

    # Act
    test_api.rename_image(testimage, "new_name")

    # Assert
    assert test_api.images().get("new_name")
    assert test_api.images().get("myimage") is None