From cf3da9aab0cfeff65f6594bdca64328cb5d69c73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Pito=C5=84?= Date: Mon, 29 Jan 2024 16:31:45 +0100 Subject: [PATCH 1/4] Format code with new black --- ariadne_graphql_proxy/proxy_schema.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ariadne_graphql_proxy/proxy_schema.py b/ariadne_graphql_proxy/proxy_schema.py index 2647cfb..3560253 100644 --- a/ariadne_graphql_proxy/proxy_schema.py +++ b/ariadne_graphql_proxy/proxy_schema.py @@ -234,9 +234,11 @@ async def root_resolver( { "operationName": operation_name, "query": print_ast(query_document), - "variables": variables - if not variables - else {key: variables[key] for key in query_variables}, + "variables": ( + variables + if not variables + else {key: variables[key] for key in query_variables} + ), }, ) for schema_id, query_document, query_variables in queries From c7fd7d994ccbc2a449c98fb91dc8632a09160fcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Pito=C5=84?= Date: Mon, 29 Jan 2024 16:38:35 +0100 Subject: [PATCH 2/4] Lock moto version at <5 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 4af409d..7944406 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,7 +26,7 @@ test = [ "black", "freezegun", "moto", - "mypy", + "mypy<5", "pytest", "pytest-mock", "pytest-httpx", From 74d7d23546889df56530f07816164c5c9a52d777 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Pito=C5=84?= Date: Mon, 29 Jan 2024 16:40:35 +0100 Subject: [PATCH 3/4] Install moto with dynamodb --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 7944406..5320d4d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,7 +26,7 @@ test = [ "black", "freezegun", "moto", - "mypy<5", + "mypy[dynamodb]", "pytest", "pytest-mock", "pytest-httpx", From e6c62f5ffc96613279ec37e10cd57e8021593b61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Pito=C5=84?= Date: Mon, 29 Jan 2024 16:45:23 +0100 Subject: [PATCH 4/4] Fix tests --- pyproject.toml | 4 ++-- tests/contrib/aws/test_cache_backend.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 5320d4d..138fa2f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,8 +25,8 @@ dependencies = ["graphql-core>=3.2.0,<3.3", "httpx", "ariadne"] test = [ "black", "freezegun", - "moto", - "mypy[dynamodb]", + "moto[dynamodb]", + "mypy", "pytest", "pytest-mock", "pytest-httpx", diff --git a/tests/contrib/aws/test_cache_backend.py b/tests/contrib/aws/test_cache_backend.py index 0d6785d..a571309 100644 --- a/tests/contrib/aws/test_cache_backend.py +++ b/tests/contrib/aws/test_cache_backend.py @@ -4,7 +4,7 @@ import boto3 import pytest from freezegun import freeze_time -from moto import mock_dynamodb +from moto import mock_aws from ariadne_graphql_proxy.contrib.aws import DynamoDBCacheBackend, DynamoDBCacheError @@ -21,7 +21,7 @@ def aws_credentials(): @pytest.fixture def test_table(aws_credentials): - with mock_dynamodb(): + with mock_aws(): table = boto3.resource("dynamodb").create_table( TableName="test_table", KeySchema=[{"AttributeName": "key", "KeyType": "HASH"}], @@ -36,7 +36,7 @@ def test_object_can_be_created_with_existing_table_name(test_table): DynamoDBCacheBackend(table_name="test_table") -@mock_dynamodb +@mock_aws def test_init_raises_dynamodb_cache_error_for_unavailable_table(aws_credentials): with pytest.raises(DynamoDBCacheError): DynamoDBCacheBackend(table_name="not_exisitng_table_name")