Skip to content

Commit

Permalink
undo change to tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kristjanvalur committed Jun 8, 2023
1 parent 838581b commit eb8c340
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
1 change: 1 addition & 0 deletions tests/schema/test_permission.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ async def user(self, info) -> typing.AsyncGenerator[str, None]:
query = "subscription { user }"

result = await schema.subscribe(query)

assert result.errors[0].message == "You are not authorized"


Expand Down
24 changes: 15 additions & 9 deletions tests/schema/test_subscription.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ async def example(self) -> typing.AsyncGenerator[str, None]:

query = "subscription { example }"

async for result in await schema.subscribe(query):
assert not result.errors
assert result.data["example"] == "Hi"
sub = await schema.subscribe(query)
result = await sub.__anext__()

assert not result.errors
assert result.data["example"] == "Hi"


@pytest.mark.asyncio
Expand All @@ -46,9 +48,11 @@ async def example(self, name: str) -> typing.AsyncGenerator[str, None]:

query = 'subscription { example(name: "Nina") }'

async for result in await schema.subscribe(query):
assert not result.errors
assert result.data["example"] == "Hi Nina"
sub = await schema.subscribe(query)
result = await sub.__anext__()

assert not result.errors
assert result.data["example"] == "Hi Nina"


requires_builtin_generics = pytest.mark.skipif(
Expand Down Expand Up @@ -87,6 +91,8 @@ class Subscription:

query = "subscription { example }"

async for result in await schema.subscribe(query):
assert not result.errors
assert result.data["example"] == "Hi"
sub = await schema.subscribe(query)
result = await sub.__anext__()

assert not result.errors
assert result.data["example"] == "Hi"

0 comments on commit eb8c340

Please sign in to comment.