def test_create_part(self, mock_create_part): parts = diskparts.PartitionsModel() dev = '/dev/sdb' size = 10 params = {'devname': dev, 'partsize': size} parts.create(params) mock_create_part.return_value = 'sdb1' mock_create_part.assert_called_with(dev, size)
def test_create_part_missing_device(self): parts = diskparts.PartitionsModel() size = 10 params = {'partsize': size} self.assertRaises(MissingParameter, parts.create, params)
def test_create_part_missing_size(self): parts = diskparts.PartitionsModel() dev = '/dev/sdb' params = {'devname': dev} self.assertRaises(MissingParameter, parts.create, params)
def test_get_part_list(self): parts = diskparts.PartitionsModel() parts_list = parts.get_list() self.assertGreaterEqual(len(parts_list), 0)