def test_device_no_grub(monkeypatch):
    run_mocked = RunMocked(no_grub=True)
    monkeypatch.setattr(library, 'run', run_mocked)
    monkeypatch.setattr(api, 'produce', testutils.produce_mocked())
    library.get_grub_device()
    assert library.run.called == 3
    assert not api.produce.model_instances
def test_get_grub_device(monkeypatch):
    run_mocked = RunMocked()
    monkeypatch.setattr(library, 'run', run_mocked)
    monkeypatch.setattr(api, 'produce', testutils.produce_mocked())
    library.get_grub_device()
    assert library.run.called == 3
    assert BOOT_DEVICE == api.produce.model_instances[0].grub_device
def test_grub_device_env_var(monkeypatch):
    run_mocked = RunMocked()
    monkeypatch.setenv('LEAPP_GRUB_DEVICE', BOOT_DEVICE_ENV)
    monkeypatch.setattr(library, 'run', run_mocked)
    monkeypatch.setattr(api, 'produce', testutils.produce_mocked())
    library.get_grub_device()
    assert library.run.called == 0
    assert BOOT_DEVICE_ENV == api.produce.model_instances[0].grub_device
def test_get_grub_device_fail(monkeypatch):
    run_mocked = RunMocked(raise_err=True)
    monkeypatch.setattr(library, 'run', run_mocked)
    monkeypatch.setattr(api, 'produce', testutils.produce_mocked())
    with pytest.raises(StopActorExecution):
        library.get_grub_device()
    assert library.run.called == 1
    assert not api.produce.model_instances
Exemple #5
0
 def process(self):
     get_grub_device()