(
self,
query,
*,
# Can/should we support operation_name somehow...
variables=None,
globals=None,
)
| 377 | raise ex |
| 378 | |
| 379 | async def _native_graphql_query( |
| 380 | self, |
| 381 | query, |
| 382 | *, |
| 383 | # Can/should we support operation_name somehow... |
| 384 | variables=None, |
| 385 | globals=None, |
| 386 | ): |
| 387 | # The graphql tests are all synchronous, and our gel |
| 388 | # connections need to be async... so we spin up a new |
| 389 | # connection and asyncio.run the coro. |
| 390 | con = await self.connect() |
| 391 | try: |
| 392 | # Ahhhhhh. We don't support with_globals on testbase |
| 393 | # connections, so.... |
| 394 | if globals: |
| 395 | glob_defs = { |
| 396 | obj.name: obj |
| 397 | for obj in |
| 398 | await con.query(''' |
| 399 | select schema::Global { |
| 400 | name, required, tname := .target.name |
| 401 | } |
| 402 | ''') |
| 403 | } |
| 404 | |
| 405 | for k, v in globals.items(): |
| 406 | glob = glob_defs[k] |
| 407 | # Why do we allow this for the HTTP proto?? |
| 408 | # We don't for binary proto stuff. |
| 409 | if v is None and glob.required: |
| 410 | continue |
| 411 | mod = 'required ' if glob.required else '' |
| 412 | await con.execute( |
| 413 | f'set global {k} := <{mod}{glob.tname}><json>$0', |
| 414 | json.dumps(v), |
| 415 | ) |
| 416 | |
| 417 | async with server.RollbackChanges(con): |
| 418 | return json.loads(await con.query_graphql_json( |
| 419 | query, |
| 420 | **(variables or {}), |
| 421 | )) |
| 422 | finally: |
| 423 | await con.aclose() |
| 424 | |
| 425 | def assert_graphql_query_result( |
| 426 | self, |
no test coverage detected