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)
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)
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)