A 401 from Django (bad/absent UserAPIKey) maps to a typed AuthError.
()
| 142 | |
| 143 | @pytest.mark.asyncio |
| 144 | async 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() |
nothing calls this directly
no test coverage detected