forked from mirrors/nixpkgs
151 lines
5.3 KiB
Diff
151 lines
5.3 KiB
Diff
diff --git a/graphene_django/filter/tests/test_fields.py b/graphene_django/filter/tests/test_fields.py
|
|
index 7d440f4..0aec6e4 100644
|
|
--- a/graphene_django/filter/tests/test_fields.py
|
|
+++ b/graphene_django/filter/tests/test_fields.py
|
|
@@ -1005,7 +1005,7 @@ def test_integer_field_filter_type():
|
|
|
|
schema = Schema(query=Query)
|
|
|
|
- assert str(schema) == dedent(
|
|
+ assert str(schema).rstrip() + "\n" == dedent(
|
|
"""\
|
|
type Query {
|
|
pets(offset: Int = null, before: String = null, after: String = null, first: Int = null, last: Int = null, age: Int = null): PetTypeConnection
|
|
@@ -1074,7 +1074,7 @@ def test_other_filter_types():
|
|
|
|
schema = Schema(query=Query)
|
|
|
|
- assert str(schema) == dedent(
|
|
+ assert str(schema).rstrip() + "\n" == dedent(
|
|
"""\
|
|
type Query {
|
|
pets(offset: Int = null, before: String = null, after: String = null, first: Int = null, last: Int = null, age: Int = null, age_Isnull: Boolean = null, age_Lt: Int = null): PetTypeConnection
|
|
diff --git a/graphene_django/tests/test_command.py b/graphene_django/tests/test_command.py
|
|
index 70116b8..a4ab4db 100644
|
|
--- a/graphene_django/tests/test_command.py
|
|
+++ b/graphene_django/tests/test_command.py
|
|
@@ -49,7 +49,7 @@ def test_generate_graphql_file_on_call_graphql_schema():
|
|
assert handle.write.called_once()
|
|
|
|
schema_output = handle.write.call_args[0][0]
|
|
- assert schema_output == dedent(
|
|
+ assert schema_output.rstrip() + "\n" == dedent(
|
|
"""\
|
|
type Query {
|
|
hi: String
|
|
diff --git a/graphene_django/tests/test_types.py b/graphene_django/tests/test_types.py
|
|
index bde72c7..0b64440 100644
|
|
--- a/graphene_django/tests/test_types.py
|
|
+++ b/graphene_django/tests/test_types.py
|
|
@@ -247,7 +247,7 @@ def test_schema_representation():
|
|
}
|
|
"""
|
|
)
|
|
- assert str(schema) == expected
|
|
+ assert str(schema).rstrip() + "\n" == expected
|
|
|
|
|
|
def with_local_registry(func):
|
|
@@ -515,7 +515,7 @@ class TestDjangoObjectType:
|
|
|
|
schema = Schema(query=Query)
|
|
|
|
- assert str(schema) == dedent(
|
|
+ assert str(schema).rstrip() + "\n" == dedent(
|
|
"""\
|
|
type Query {
|
|
pet: Pet
|
|
@@ -541,7 +541,7 @@ class TestDjangoObjectType:
|
|
|
|
schema = Schema(query=Query)
|
|
|
|
- assert str(schema) == dedent(
|
|
+ assert str(schema).rstrip() + "\n" == dedent(
|
|
"""\
|
|
type Query {
|
|
pet: Pet
|
|
@@ -576,7 +576,7 @@ class TestDjangoObjectType:
|
|
|
|
schema = Schema(query=Query)
|
|
|
|
- assert str(schema) == dedent(
|
|
+ assert str(schema).rstrip() + "\n" == dedent(
|
|
"""\
|
|
type Query {
|
|
pet: Pet
|
|
@@ -603,7 +603,7 @@ class TestDjangoObjectType:
|
|
|
|
schema = Schema(query=Query)
|
|
|
|
- assert str(schema) == dedent(
|
|
+ assert str(schema).rstrip() + "\n" == dedent(
|
|
"""\
|
|
type Query {
|
|
pet: PetModelKind
|
|
@@ -642,7 +642,7 @@ class TestDjangoObjectType:
|
|
|
|
schema = Schema(query=Query)
|
|
|
|
- assert str(schema) == dedent(
|
|
+ assert str(schema).rstrip() + "\n" == dedent(
|
|
"""\
|
|
type Query {
|
|
pet: PetModelKind
|
|
diff --git a/graphene_django/tests/test_views.py b/graphene_django/tests/test_views.py
|
|
index 945fa87..e2e8b46 100644
|
|
--- a/graphene_django/tests/test_views.py
|
|
+++ b/graphene_django/tests/test_views.py
|
|
@@ -109,12 +109,10 @@ def test_reports_validation_errors(client):
|
|
{
|
|
"message": "Cannot query field 'unknownOne' on type 'QueryRoot'.",
|
|
"locations": [{"line": 1, "column": 9}],
|
|
- "path": None,
|
|
},
|
|
{
|
|
"message": "Cannot query field 'unknownTwo' on type 'QueryRoot'.",
|
|
"locations": [{"line": 1, "column": 21}],
|
|
- "path": None,
|
|
},
|
|
]
|
|
}
|
|
@@ -135,8 +133,6 @@ def test_errors_when_missing_operation_name(client):
|
|
"errors": [
|
|
{
|
|
"message": "Must provide operation name if query contains multiple operations.",
|
|
- "locations": None,
|
|
- "path": None,
|
|
}
|
|
]
|
|
}
|
|
@@ -476,8 +472,7 @@ def test_handles_syntax_errors_caught_by_graphql(client):
|
|
"errors": [
|
|
{
|
|
"locations": [{"column": 1, "line": 1}],
|
|
- "message": "Syntax Error: Unexpected Name 'syntaxerror'.",
|
|
- "path": None,
|
|
+ "message": "Syntax Error: Unexpected Name 'syntaxerror'."
|
|
}
|
|
]
|
|
}
|
|
diff --git a/graphene_django/views.py b/graphene_django/views.py
|
|
index c23b020..f533f70 100644
|
|
--- a/graphene_django/views.py
|
|
+++ b/graphene_django/views.py
|
|
@@ -11,7 +11,6 @@ from django.views.decorators.csrf import ensure_csrf_cookie
|
|
from django.views.generic import View
|
|
from graphql import OperationType, get_operation_ast, parse, validate
|
|
from graphql.error import GraphQLError
|
|
-from graphql.error import format_error as format_graphql_error
|
|
from graphql.execution import ExecutionResult
|
|
|
|
from graphene import Schema
|
|
@@ -387,7 +386,7 @@ class GraphQLView(View):
|
|
@staticmethod
|
|
def format_error(error):
|
|
if isinstance(error, GraphQLError):
|
|
- return format_graphql_error(error)
|
|
+ return error.formatted
|
|
|
|
return {"message": str(error)}
|
|
|