def test_list_volumes(self): """ Test if it list configured volumes """ mock = MagicMock(return_value=xml_volume_absent) with patch.dict(glusterfs.__salt__, {"cmd.run": mock}): self.assertListEqual(glusterfs.list_volumes(), []) mock = MagicMock(return_value=xml_volume_present) with patch.dict(glusterfs.__salt__, {"cmd.run": mock}): self.assertListEqual(glusterfs.list_volumes(), ["Newvolume1", "Newvolume2"])
def test_list_volumes(self): ''' Test if it list configured volumes ''' mock = MagicMock(return_value=xml_volume_absent) with patch.dict(glusterfs.__salt__, {'cmd.run': mock}): self.assertListEqual(glusterfs.list_volumes(), []) mock = MagicMock(return_value=xml_volume_present) with patch.dict(glusterfs.__salt__, {'cmd.run': mock}): self.assertListEqual(glusterfs.list_volumes(), ['Newvolume1', 'Newvolume2'])
def test_list_volumes(self): ''' Test if it list configured volumes ''' mock = MagicMock(return_value='No volumes present in cluster') with patch.dict(glusterfs.__salt__, {'cmd.run': mock}): self.assertListEqual(glusterfs.list_volumes(), []) mock = MagicMock(return_value='Newvolume1\nNewvolume2') with patch.dict(glusterfs.__salt__, {'cmd.run': mock}): self.assertListEqual(glusterfs.list_volumes(), ['Newvolume1', 'Newvolume2'])