def test_setrelease_skip_rhsm(monkeypatch, product):
    commands_called, _ = not_isolated_actions()
    monkeypatch.setenv('LEAPP_DEVEL_SKIP_RHSM', '1')
    monkeypatch.setattr(config, 'get_product_type', lambda dummy: product)
    # To make this work we need to re-apply the decorator, so it respects the environment variable
    monkeypatch.setattr(rhsm, 'set_release', rhsm.with_rhsm(rhsm.set_release))
    library.set_rhsm_release()
    assert not commands_called
def test_setrelease_skip_rhsm(monkeypatch):
    commands_called, klass = not_isolated_actions()
    monkeypatch.setenv('LEAPP_DEVEL_SKIP_RHSM', '1')
    # To make this work we need to re-apply the decorator, so it respects the environment variable
    monkeypatch.setattr(rhsm, 'set_release', rhsm.with_rhsm(rhsm.set_release))
    monkeypatch.setattr(mounting, 'NotIsolatedActions', klass)
    monkeypatch.setattr(api, 'consume', lambda *x: (x for x in (TargetRHSMInfo(release='6.6'),)))
    library.set_rhsm_release()
    assert not commands_called
示例#3
0
def test_setrelease_skip_rhsm(monkeypatch, product):
    commands_called, _ = not_isolated_actions()
    monkeypatch.setattr(api, 'current_actor',
                        CurrentActorMocked(envars={'LEAPP_NO_RHSM': '1'}))
    monkeypatch.setattr(api, 'current_logger', logger_mocked())
    monkeypatch.setattr(config, 'get_product_type', lambda dummy: product)
    # To make this work we need to re-apply the decorator, so it respects the environment variable
    monkeypatch.setattr(rhsm, 'set_release', rhsm.with_rhsm(rhsm.set_release))
    enablerhsmtargetrepos.set_rhsm_release()
    assert not commands_called