def test_first_os_found_is_returned(mockery): class AlwaysFail(object): def installed_on(*args): raise ValueError not_installed = mockery.CreateMockAnything() installed = mockery.CreateMockAnything() executor = lambda _: None not_installed.installed_on("any.host.com", executor).AndReturn(False) installed.installed_on("any.host.com", executor).AndReturn(True) installed.__call__(executor) mockery.ReplayAll() chigrin.detect_os("any.host.com", lambda _: executor, lambda: [not_installed, installed, AlwaysFail()])
def wrapper(): return f(chigrin.detect_os(host))
def test_raises_error_when_no_os_installed_on_host(): stub_efactory = lambda h: lambda c: None stub_oslister = lambda: [] chigrin.detect_os("any.host.com", stub_efactory, stub_oslister)