def test_produce_pci_devices(current_actor_libraries):
    output = []

    def fake_producer(*args):
        output.extend(args)

    devices = [
        PCIDevice(slot='00:00.0',
                  dev_cls='Host bridge',
                  vendor='Intel Corporation',
                  name='440FX - 82441FX PMC [Natoma]',
                  subsystem_vendor='Red Hat, Inc.',
                  subsystem_name='Qemu virtual machine',
                  rev='02'),
        PCIDevice(slot='00:01.0',
                  dev_cls='ISA bridge',
                  vendor='Intel Corporation',
                  name='82371SB PIIX3 ISA [Natoma/Triton II]',
                  subsystem_vendor='Red Hat, Inc.',
                  subsystem_name='Qemu virtual machine'),
        PCIDevice(slot='00:01.1',
                  dev_cls='IDE interface',
                  vendor='Intel Corporation',
                  name='82371SB PIIX3 IDE [Natoma/Triton II]',
                  subsystem_vendor='Red Hat, Inc.',
                  subsystem_name='Qemu virtual machine',
                  progif='80'),
    ]

    produce_pci_devices(fake_producer, devices)
    assert len(output) == 1
    assert len(output[0].devices) == 3
def test_produce_no_devices(current_actor_libraries):
    output = []

    def fake_producer(*args):
        output.extend(args)

    produce_pci_devices(fake_producer, [])
    assert len(output) == 1
    assert not output[0].devices
Exemplo n.º 3
0
def test_produce_no_devices():
    output = []

    def fake_producer(*args):
        output.extend(args)

    produce_pci_devices(fake_producer, [])
    assert len(output) == 1
    assert not output[0].devices