Here are the examples of the python api tests.mock.Volume taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
3 Examples
3
Source : test_goutte.py
with GNU General Public License v3.0
from etienne-napoleone
with GNU General Public License v3.0
from etienne-napoleone
def test_process_volumes(caplog, monkeypatch):
def get_volumes(names):
return [mock.Volume(name='testvol')]
conf = {'retention': 1, 'volumes': {'names': ['testvol']}}
monkeypatch.setattr(main, '_get_volumes', get_volumes)
monkeypatch.setattr(main, '_prune_volume_snapshots', mock.nothing)
monkeypatch.setattr(main, '_snapshot_volume', mock.nothing)
with caplog.at_level('INFO'):
main._process_volumes(conf=conf, only=None)
assert len(caplog.records) == 0
def test_process_volumes_no_vol(caplog, monkeypatch):
3
Source : test_goutte.py
with GNU General Public License v3.0
from etienne-napoleone
with GNU General Public License v3.0
from etienne-napoleone
def test_process_volumes_key_error(caplog, monkeypatch):
def get_volumes(names):
return [mock.Volume(name='testvol')]
conf = {'retention': 1, 'volumes': {'names': ['testvol2']}}
monkeypatch.setattr(main, '_get_volumes', get_volumes)
monkeypatch.setattr(main, '_prune_volume_snapshots', mock.nothing)
monkeypatch.setattr(main, '_snapshot_volume', mock.nothing)
with caplog.at_level('INFO'):
main._process_volumes(conf=conf, only=None)
assert len(caplog.records) == 0
def test_get_droplets(monkeypatch):
3
Source : test_goutte.py
with GNU General Public License v3.0
from etienne-napoleone
with GNU General Public License v3.0
from etienne-napoleone
def test_snapshot_volume(caplog):
volume = mock.Volume('testvol')
with caplog.at_level('INFO'):
main._snapshot_volume(volume)
assert len(caplog.records) == 1
assert caplog.records[0].levelname == 'INFO'
assert 'testvol' in caplog.records[0].message
def test_prune_volume_snapshots(caplog):