test: cover operation contect error paths

This commit is contained in:
2025-12-23 04:50:10 +01:00
parent 3b84be90b7
commit b6e0c55c3e

View File

@@ -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())