Skip to content

Commit

Permalink
up up
Browse files Browse the repository at this point in the history
  • Loading branch information
jhnnsrs committed Jan 2, 2024
1 parent 4381509 commit c70bfed
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 22 deletions.
12 changes: 11 additions & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@
"rath"
],
"problemMatcher": []
}
},
{
"label": "Clean Up",
"type": "shell",
"command": "poetry run ruff --fix . && poetry run black ."
},
{
"label": "Check",
"type": "shell",
"command": "poetry run mypy ."
},
]
}
1 change: 0 additions & 1 deletion rath/links/httpx.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ async def aexecute(self, operation: Operation) -> AsyncIterator[GraphQLResult]:
post_kwargs = {"json": payload}

async with httpx.AsyncClient() as client:

response = await client.post(
self.endpoint_url, headers=operation.context.headers, **post_kwargs
)
Expand Down
3 changes: 2 additions & 1 deletion rath/links/shrink.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
class ShrinkingLink(ParsingLink):

"""Shrinking Link is a link that shrinks operation variables.
It traverses the variables dict, and converts any model that has a .ashrink() method to its id."""
It traverses the variables dict, and converts any model that has a .ashrink() method to its id.
"""

async def aparse(self, operation: Operation) -> Operation:
"""Parses an operation
Expand Down
3 changes: 0 additions & 3 deletions tests/test_countries_api_httpx.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ def real_world_link():

@pytest.mark.public
async def test_query_async(real_world_link):

rath = Rath(link=real_world_link)

async with rath:
Expand All @@ -25,7 +24,6 @@ async def test_query_async(real_world_link):

@pytest.mark.public
def test_query_sync(real_world_link):

rath = Rath(link=real_world_link)

with rath:
Expand All @@ -36,7 +34,6 @@ def test_query_sync(real_world_link):

@pytest.mark.public
async def test_validation(real_world_link):

link = ValidatingLink(allow_introspection=True)

rath = Rath(link=compose(link, real_world_link))
Expand Down
1 change: 0 additions & 1 deletion tests/test_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ def mock_link():


async def test_dicting(mock_link):

link = DictingLink()

class DictableX(BaseModel):
Expand Down
4 changes: 2 additions & 2 deletions tests/test_sign_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def is_query(op: Operation):
return op.node.operation == OperationType.QUERY

def has_token_header(op: Operation):
return op.context.headers.get("token") is not None
return op.context.headers.get("Authorization") is not None

async def load_payload(operation: Operation):
return {
Expand All @@ -30,6 +30,6 @@ async def load_payload(operation: Operation):
ComposedSignTokenLink(
private_key="private_key.pem", payload_retriever=load_payload
),
AssertLink(assertions=[is_query]),
AssertLink(assertions=[has_token_header, is_query]),
)
await run_basic_query(x)
6 changes: 0 additions & 6 deletions tests/test_split.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ def stateful_mock_link():


async def test_aquery(mock_link_left, mock_link_right):

rath = Rath(
link=split(
mock_link_left,
Expand All @@ -51,7 +50,6 @@ async def test_aquery(mock_link_left, mock_link_right):


async def test_stateful_mock(stateful_mock_link):

async with Rath(link=stateful_mock_link) as rath:
await rath.aquery(
"""
Expand All @@ -66,9 +64,7 @@ async def test_stateful_mock(stateful_mock_link):


def test_stateful_mock_sync(stateful_mock_link):

with Rath(link=stateful_mock_link) as rath:

rath.query(
"""
query {
Expand All @@ -81,7 +77,6 @@ def test_stateful_mock_sync(stateful_mock_link):


async def test_asubscribe(mock_link_left, mock_link_right):

rath = Rath(
link=split(
mock_link_left,
Expand All @@ -91,7 +86,6 @@ async def test_asubscribe(mock_link_left, mock_link_right):
)

async with rath as r:

async for ev in r.asubscribe(
"""
subscription {
Expand Down
2 changes: 0 additions & 2 deletions tests/test_transpile.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ def transpile_beasts(value, depth):
)

async with rath:

x = await acreate_transpiled_beast(non_optional_parameter=1, vectors=[[2, 3]])


Expand All @@ -64,5 +63,4 @@ def transpile_beasts(value, depth):
)
)
with rath:

x = create_transpiled_beast(non_optional_parameter=1, vectors=[[2, 3]])
2 changes: 0 additions & 2 deletions tests/test_turms.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ def mock_link():


async def test_query_async(mock_link):

rath = Rath(link=mock_link)

async with rath:
Expand All @@ -24,7 +23,6 @@ async def test_query_async(mock_link):


def test_query_sync(mock_link):

rath = Rath(link=mock_link)

with rath:
Expand Down
3 changes: 0 additions & 3 deletions tests/test_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,9 @@ def mock_link():


async def test_validation(mock_link):

link = ValidatingLink(schema_glob=build_relative_glob("/schemas/beasts.graphql"))

async with Rath(link=compose(link, mock_link)) as r:

await r.aquery(
"""
query {
Expand All @@ -80,7 +78,6 @@ async def test_validation(mock_link):


async def test_validation_error(mock_link):

link = ValidatingLink(schema_dsl=schema)

rath = Rath(link=compose(link, mock_link))
Expand Down

0 comments on commit c70bfed

Please sign in to comment.