예제 #1
0
def test_internet_connected(monkeypatch, connected: bool) -> None:
    def request(*args: Any, **kwargs: Any) -> None:
        if not connected:
            raise socket.gaierror(0)

    monkeypatch.setattr(http.client.HTTPConnection, "request", request)
    assert internet_connected() is connected
예제 #2
0
def internet_ok():
    return internet_connected()
예제 #3
0
def internet_ok() -> bool:
    return internet_connected()