| 60 | |
| 61 | |
| 62 | async def test_query_error(client: dagger.Client, httpx_mock: HTTPXMock): |
| 63 | msg = "invalid reference format" |
| 64 | error = { |
| 65 | "message": msg, |
| 66 | "path": ["container", "from"], |
| 67 | "locations": [{"line": 3, "column": 5}], |
| 68 | } |
| 69 | httpx_mock.add_response(json={"errors": [error]}) |
| 70 | |
| 71 | with pytest.raises(dagger.QueryError) as exc_info: |
| 72 | await client.container().from_("invalid!") |
| 73 | |
| 74 | exc = exc_info.value |
| 75 | assert msg in str(exc) |
| 76 | assert exc.errors[0].path == ["container", "from"] |
| 77 | assert exc.errors[0].locations is not None |
| 78 | assert exc.errors[0].locations[0].line == 3 |
| 79 | assert exc.errors[0].locations[0].column == 5 |
| 80 | |
| 81 | |
| 82 | async def test_no_path_query_error(client: dagger.Client, httpx_mock: HTTPXMock): |