Ejemplo n.º 1
0
    def test_get_vgs_single_vg(self, monkeypatch):
        vg1 = api.VolumeGroup(vg_name='vg'); vgs = [vg1]
        stdout = ['{};;;;;;'.format(vg1.vg_name)]
        monkeypatch.setattr(api.process, 'call', lambda x,**kw: (stdout, '', 0))

        vgs_ = api.get_vgs()
        assert len(vgs_) == 1
        assert vgs_[0].vg_name == vgs[0].vg_name
Ejemplo n.º 2
0
    def test_get_vgs(self, monkeypatch):
        vg1 = api.VolumeGroup(vg_name='vg1')
        vg2 = api.VolumeGroup(vg_name='vg2')
        vgs = [vg1, vg2]
        stdout = ['{};;;;;;'.format(vg1.vg_name),
                  '{};;;;;;'.format(vg2.vg_name)]
        monkeypatch.setattr(api.process, 'call', lambda x,**kw: (stdout, '', 0))

        vgs_ = api.get_vgs()
        assert len(vgs_) == len(vgs)
        for vg, vg_ in zip(vgs, vgs_):
            assert vg_.vg_name == vg.vg_name
Ejemplo n.º 3
0
 def test_get_vgs_empty(self, monkeypatch):
     monkeypatch.setattr(api.process, 'call', lambda x,**kw: ('', '', 0))
     assert api.get_vgs() == []