Here are the examples of the python api tests.mock.nothing taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
5 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_droplets_no_vol(caplog, monkeypatch):
def get_droplets(names):
return []
conf = {'retention': 1, 'droplets': {'names': ['testdroplet']}}
monkeypatch.setattr(main, '_get_droplets', get_droplets)
monkeypatch.setattr(main, '_prune_droplet_snapshots', mock.nothing)
monkeypatch.setattr(main, '_snapshot_droplet', mock.nothing)
with caplog.at_level('INFO'):
main._process_droplets(conf=conf, only=None)
assert len(caplog.records) == 1
assert caplog.records[0].levelname == 'WARNING'
def test_process_droplets_key_error(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_no_vol(caplog, monkeypatch):
def get_volumes(names):
return []
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) == 1
assert caplog.records[0].levelname == 'WARNING'
def test_process_volumes_key_error(caplog, monkeypatch):
0
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_entrypoint(caplog, monkeypatch):
def load_config(*args):
return {'retention': 2}
monkeypatch.setattr(main, '_load_config', load_config)
monkeypatch.setattr(main, '_process_droplets', mock.nothing)
monkeypatch.setattr(main, '_process_volumes', mock.nothing)
runner = CliRunner()
with runner.isolated_filesystem():
with caplog.at_level('INFO'):
with open('test.toml', 'w') as f:
f.write('Hello World!')
result = runner.invoke(main.entrypoint, [
'test.toml',
'token123',
])
assert result.exit_code == 0
assert len(caplog.records) == 1
assert caplog.records[0].levelname == 'INFO'
def test_entrypoint_debug(caplog, monkeypatch):
0
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_entrypoint_debug(caplog, monkeypatch):
def load_config(*args):
return {'retention': 2}
monkeypatch.setattr(main, '_load_config', load_config)
monkeypatch.setattr(main, '_process_droplets', mock.nothing)
monkeypatch.setattr(main, '_process_volumes', mock.nothing)
monkeypatch.setattr(main.log, 'setLevel', mock.nothing)
runner = CliRunner()
with runner.isolated_filesystem():
with caplog.at_level('INFO'):
with open('test.toml', 'w') as f:
f.write('Hello World!')
result = runner.invoke(main.entrypoint, [
'test.toml',
'token123',
'--debug',
])
assert result.exit_code == 0
assert len(caplog.records) == 1
assert caplog.records[0].levelname == 'INFO'
def test_entrypoint_only(caplog, monkeypatch):
0
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_entrypoint_only(caplog, monkeypatch):
def load_config(*args):
return {'retention': 2}
monkeypatch.setattr(main, '_load_config', load_config)
monkeypatch.setattr(main, '_process_droplets', mock.nothing)
monkeypatch.setattr(main, '_process_volumes', mock.nothing)
monkeypatch.setattr(main.log, 'setLevel', mock.nothing)
runner = CliRunner()
with runner.isolated_filesystem():
with caplog.at_level('INFO'):
with open('test.toml', 'w') as f:
f.write('Hello World!')
result = runner.invoke(main.entrypoint, [
'test.toml',
'token123',
'--debug',
'--only', 'prune',
])
assert result.exit_code == 0
assert len(caplog.records) == 1
assert caplog.records[0].levelname == 'INFO'
def test_load_config(monkeypatch):