From b6e0c55c3ea843912c4fe8ff0bb5e0abfba236a2 Mon Sep 17 00:00:00 2001 From: Kharec Date: Tue, 23 Dec 2025 04:50:10 +0100 Subject: [PATCH] test: cover operation contect error paths --- tests/test_operation_context.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 tests/test_operation_context.py diff --git a/tests/test_operation_context.py b/tests/test_operation_context.py new file mode 100644 index 0000000..6b338ff --- /dev/null +++ b/tests/test_operation_context.py @@ -0,0 +1,30 @@ +import pytest + +import skywipe.operations as operations + + +def test_operation_context_raises_on_auth_error(monkeypatch): + class FakeAuth: + def login(self): + raise ValueError("bad auth") + + monkeypatch.setattr(operations, "Auth", FakeAuth) + + with pytest.raises(ValueError, match="bad auth"): + operations.OperationContext() + + +def test_operation_context_raises_on_config_error(monkeypatch): + class FakeClient: + class Me: + did = "did:plc:fake" + + me = Me() + + def fake_load(self): + raise ValueError("bad config") + + monkeypatch.setattr(operations.Configuration, "load", fake_load) + + with pytest.raises(ValueError, match="bad config"): + operations.OperationContext(client=FakeClient())