diff --git a/graphene/contrib/django/tests/filter/test_fields.py b/graphene/contrib/django/tests/filter/test_fields.py index 33cc2421..4c93ca1e 100644 --- a/graphene/contrib/django/tests/filter/test_fields.py +++ b/graphene/contrib/django/tests/filter/test_fields.py @@ -35,12 +35,13 @@ class PetNode(DjangoNode): class Meta: model = Pet +schema = Schema() def assert_arguments(field, *arguments): ignore = ('after', 'before', 'first', 'last', 'orderBy') actual = [ name - for name in field.arguments.arguments.keys() + for name in schema.T(field.arguments) if name not in ignore and not name.startswith('_') ] assert set(arguments) == set(actual), \ @@ -51,12 +52,12 @@ def assert_arguments(field, *arguments): def assert_orderable(field): - assert 'orderBy' in field.arguments.arguments.keys(), \ + assert 'orderBy' in schema.T(field.arguments), \ 'Field cannot be ordered' def assert_not_orderable(field): - assert 'orderBy' not in field.arguments.arguments.keys(), \ + assert 'orderBy' not in schema.T(field.arguments), \ 'Field can be ordered' diff --git a/graphene/contrib/django/tests/test_query.py b/graphene/contrib/django/tests/test_query.py index 090c8695..4b37d517 100644 --- a/graphene/contrib/django/tests/test_query.py +++ b/graphene/contrib/django/tests/test_query.py @@ -1,3 +1,4 @@ +import pytest from py.test import raises import graphene @@ -7,6 +8,9 @@ from graphene.contrib.django import DjangoNode, DjangoObjectType from .models import Article, Reporter +pytestmark = pytest.mark.django_db + + def test_should_query_only_fields(): with raises(Exception): class ReporterType(DjangoObjectType): diff --git a/graphene/contrib/django/utils.py b/graphene/contrib/django/utils.py index 38bf7546..4be3c55f 100644 --- a/graphene/contrib/django/utils.py +++ b/graphene/contrib/django/utils.py @@ -66,7 +66,7 @@ def get_filtering_args_from_filterset(filterset_class, type): # Also add the 'order_by' field if filterset_class._meta.order_by: - args[filterset_class.order_by_field] = Argument(String) + args[filterset_class.order_by_field] = Argument(String()) return args