MCPcopy Index your code
hub / github.com/commandoperator/cmdop-sdk / test_skills_install_auth_error

Function test_skills_install_auth_error

python/tests/test_skills.py:144–168  ·  view source on GitHub ↗

A 401 from Django (bad/absent UserAPIKey) maps to a typed AuthError.

()

Source from the content-addressed store, hash-verified

142
143@pytest.mark.asyncio
144async def test_skills_install_auth_error() -> None:
145 """A 401 from Django (bad/absent UserAPIKey) maps to a typed AuthError."""
146 t, proc = _make_transport()
147 skills = SkillsResource(_FakeClient(t)) # type: ignore[arg-type]
148
149 # ErrorInfo lives in machines_pb2 (shared across namespaces).
150 from cmdop._proto.cmdop.core.v1 import machines_pb2 as m_pb
151
152 async def core() -> None:
153 req = await _read_request(proc)
154 assert req.WhichOneof("payload") == "skills_install_req"
155 _feed(
156 proc,
157 pb.Envelope(
158 id=req.id,
159 kind=pb.Envelope.KIND_ERROR,
160 error=m_pb.ErrorInfo(code="auth", message="invalid api key"),
161 ),
162 )
163
164 core_task = asyncio.create_task(core())
165 with pytest.raises(AuthError, match="invalid api key"):
166 await skills.install("browser")
167 await core_task
168 await t.aclose()

Callers

nothing calls this directly

Calls 6

installMethod · 0.95
SkillsResourceClass · 0.90
_FakeClientClass · 0.85
_make_transportFunction · 0.70
coreFunction · 0.70
acloseMethod · 0.45

Tested by

no test coverage detected