Exemplo n.º 1
0
 def test_report_has_stuff_with_empty_attrs(self, monkeypatch):
     report = ['  VolGroup00 ;;;;;;9g']
     monkeypatch.setattr(api.process, 'call', lambda x: (report, '', 0))
     result = api.get_api_vgs()[0]
     assert len(result.keys()) == 7
     assert result['vg_name'] == 'VolGroup00'
     assert result['vg_free'] == '9g'
Exemplo n.º 2
0
 def test_report_has_multiple_items(self, monkeypatch):
     report = ['   VolGroup00;;;;;;;', '    ceph_vg;;;;;;;']
     monkeypatch.setattr(api.process, 'call', lambda x, **kw:
                         (report, '', 0))
     result = api.get_api_vgs()
     assert result[0]['vg_name'] == 'VolGroup00'
     assert result[1]['vg_name'] == 'ceph_vg'
Exemplo n.º 3
0
 def test_report_has_stuff_with_empty_attrs(self, monkeypatch):
     report = ['  VolGroup00 ;;;;;;9g']
     monkeypatch.setattr(api.process, 'call', lambda x: (report, '', 0))
     result = api.get_api_vgs()[0]
     assert len(result.keys()) == 7
     assert result['vg_name'] == 'VolGroup00'
     assert result['vg_free'] == '9g'
Exemplo n.º 4
0
 def test_report_has_stuff(self, monkeypatch):
     report = ['  VolGroup00']
     monkeypatch.setattr(api.process, 'call', lambda x, **kw:
                         (report, '', 0))
     assert api.get_api_vgs() == [{'vg_name': 'VolGroup00'}]
Exemplo n.º 5
0
 def test_report_is_emtpy(self, monkeypatch):
     monkeypatch.setattr(api.process, 'call', lambda x, **kw:
                         ('\n\n', '', 0))
     assert api.get_api_vgs() == []
Exemplo n.º 6
0
 def test_report_has_multiple_items(self, monkeypatch):
     report = ['   VolGroup00;;;;;;;', '    ceph_vg;;;;;;;']
     monkeypatch.setattr(api.process, 'call', lambda x: (report, '', 0))
     result = api.get_api_vgs()
     assert result[0]['vg_name'] == 'VolGroup00'
     assert result[1]['vg_name'] == 'ceph_vg'
Exemplo n.º 7
0
 def test_report_has_stuff(self, monkeypatch):
     report = ['  VolGroup00']
     monkeypatch.setattr(api.process, 'call', lambda x: (report, '', 0))
     assert api.get_api_vgs() == [{'vg_name': 'VolGroup00'}]
Exemplo n.º 8
0
 def test_report_is_emtpy(self, monkeypatch):
     monkeypatch.setattr(api.process, 'call', lambda x: ('\n\n', '', 0))
     assert api.get_api_vgs() == []
Exemplo n.º 9
0
def get_api_vgs():
    """
    Return the list of group volumes available in the system ...
    """
    vgs = lvm.get_api_vgs()
    return vgs