def test_report_has_multiple_items(self, monkeypatch): report = [' ;/path;VolName;root', ';/dev/path;ceph_lv;ceph_vg'] monkeypatch.setattr(api.process, 'call', lambda x, **kw: (report, '', 0)) result = api.get_api_lvs() assert result[0]['lv_name'] == 'VolName' assert result[1]['lv_name'] == 'ceph_lv'
def is_lv(device_name): """ Boolean to detect if a device is an LV or not ... """ dev_name = "/dev/" + device_name is_logical_volume = False lvs = lvm.get_api_lvs() if lvs is not None: for lv in lvs: if lv["lv_path"] == dev_name: is_logical_volume = True break return is_logical_volume
def test_report_has_stuff(self, monkeypatch): report = [' ;/path;VolGroup00;root'] monkeypatch.setattr(api.process, 'call', lambda x, **kw: (report, '', 0)) result = api.get_api_lvs() assert result[0]['lv_name'] == 'VolGroup00'
def test_report_is_emtpy(self, monkeypatch): monkeypatch.setattr(api.process, 'call', lambda x, **kw: ('', '', 0)) assert api.get_api_lvs() == []
def test_report_has_multiple_items(self, monkeypatch): report = [' ;/path;VolName;root', ';/dev/path;ceph_lv;ceph_vg'] monkeypatch.setattr(api.process, 'call', lambda x: (report, '', 0)) result = api.get_api_lvs() assert result[0]['lv_name'] == 'VolName' assert result[1]['lv_name'] == 'ceph_lv'
def test_report_has_stuff(self, monkeypatch): report = [' ;/path;VolGroup00;root'] monkeypatch.setattr(api.process, 'call', lambda x: (report, '', 0)) result = api.get_api_lvs() assert result[0]['lv_name'] == 'VolGroup00'
def test_report_is_emtpy(self, monkeypatch): monkeypatch.setattr(api.process, 'call', lambda x: ('', '', 0)) assert api.get_api_lvs() == []
def get_api_lvs(): """ Return the list of logical volumes available in the system ... """ lvs = lvm.get_api_lvs() return lvs
def monkey_populate(self): api.volumes_obj_create_count += 1 for lv_item in api.get_api_lvs(): self.append(api.Volume(**lv_item))