def fetcher(self, file_cache: DefaultAgentFileCache) -> IPMIFetcher: return IPMIFetcher( file_cache, address="1.2.3.4", username="******", password="******", )
def fetcher(self, file_cache): return IPMIFetcher( file_cache, address="1.2.3.4", username="******", password="******", )
def test_command_raises_IpmiException_handling(self, file_cache, monkeypatch): def open_(*args): raise IpmiException() monkeypatch.setattr(IPMIFetcher, "open", open_) with pytest.raises(MKFetcherError): with IPMIFetcher( file_cache, address="127.0.0.1", username="", password="", ): pass
def test_command_raises_IpmiException_handling( self, file_cache: AgentFileCache, monkeypatch: MonkeyPatch) -> None: def open_(*args): raise IpmiException() monkeypatch.setattr(IPMIFetcher, "open", open_) with IPMIFetcher( file_cache, address="127.0.0.1", username="", password="", ) as fetcher: fetched = fetcher.fetch(Mode.CHECKING) assert isinstance(fetched.error, MKFetcherError)
def test_with_cached_does_not_open(self, file_cache: AgentFileCache, monkeypatch: MonkeyPatch) -> None: def open_(*args): raise IpmiException() monkeypatch.setattr(IPMIFetcher, "open", open_) file_cache.write(AgentRawData(b"<<<whatever>>>"), Mode.CHECKING) with IPMIFetcher( file_cache, address="127.0.0.1", username="", password="", ) as fetcher: fetched = fetcher.fetch(Mode.CHECKING) assert fetched.is_ok()