diff options
| author | Danilo M. <danix@danix.xyz> | 2026-11-09 18:25:59 +0100 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-11-09 18:25:59 +0100 |
| commit | 7f99167f0b6a3c83bf77e20bc5e03942b901fb71 (patch) | |
| tree | 6b60263b6f702e6088eae30087c6dfa2a5a71f4c /tests/test_obsclient.py | |
| parent | 03e2adab3fb58532ba1e32c2f01a9ec14f11e484 (diff) | |
| download | deck-it-7f99167f0b6a3c83bf77e20bc5e03942b901fb71.tar.gz deck-it-7f99167f0b6a3c83bf77e20bc5e03942b901fb71.zip | |
fix: OBS idle timeout, payload validation, workspace list
Diffstat (limited to 'tests/test_obsclient.py')
| -rw-r--r-- | tests/test_obsclient.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/test_obsclient.py b/tests/test_obsclient.py index 7d1a5ca..54eadd1 100644 --- a/tests/test_obsclient.py +++ b/tests/test_obsclient.py @@ -25,5 +25,27 @@ class Disconnected(unittest.TestCase): oc.ObsClient(host="127.0.0.1", port=4455, password="").request("GetVersion") +class RecvLoop(unittest.TestCase): + def test_a_recv_timeout_does_not_end_the_loop(self): + import websocket + + class FakeWS: + calls = 0 + + def recv(self): + FakeWS.calls += 1 + if FakeWS.calls <= 3: + raise websocket.WebSocketTimeoutException("idle") + raise RuntimeError("closed") + + c = oc.ObsClient() + c.ws = FakeWS() + c.connected = True + c._recv_loop() + # It kept calling recv past three idle timeouts; a timeout must not + # look like a closed socket. + self.assertEqual(FakeWS.calls, 4) + + if __name__ == "__main__": unittest.main() |
