示例#1
0
def testGetHarddisksFailsIfNoDisks():
    testData = [
        '/no/dev/sdb:  19922944',
        'total: 19922944 blocks',
    ]

    with mock.patch('OPSI.System.Posix.execute'):
        with pytest.raises(Exception):
            Posix.getHarddisks(data=testData)
示例#2
0
def testGetHarddisks():
    testData = [
        '/dev/sda:  19922944',
        'total: 19922944 blocks',
    ]

    with mock.patch('OPSI.System.Posix.execute'):
        disks = Posix.getHarddisks(data=testData)

    assert 1 == len(disks)
示例#3
0
def testGetHarddisksIgnoresEverythingOutsideDev():
    testData = [
        '/no/dev/sdb:  19922944',
        '/dev/sda:  19922944',
        '/tmp/sda:  19922944',
        'total: 19922944 blocks',
    ]

    with mock.patch('OPSI.System.Posix.execute'):
        disks = Posix.getHarddisks(data=testData)

    assert 1 == len(disks)