diff --git a/graphene_django/tests/test_views.py b/graphene_django/tests/test_views.py index c31db8d..c13fa56 100644 --- a/graphene_django/tests/test_views.py +++ b/graphene_django/tests/test_views.py @@ -386,6 +386,24 @@ def test_allows_post_with_get_operation_name(client): } +@pytest.mark.urls('graphene_django.tests.urls_inherited') +def test_inherited_class_with_attributes_works(client): + inherited_url = '/graphql/inherited/' + # Check schema and pretty attributes work + response = client.post(url_string(inherited_url, query='{test}')) + assert response.content.decode() == ( + '{\n' + ' "data": {\n' + ' "test": "Hello World"\n' + ' }\n' + '}' + ) + + # Check graphiql works + response = client.get(url_string(inherited_url), HTTP_ACCEPT='text/html') + assert response.status_code == 200 + + @pytest.mark.urls('graphene_django.tests.urls_pretty') def test_supports_pretty_printing(client): response = client.get(url_string(query='{test}')) diff --git a/graphene_django/tests/urls_inherited.py b/graphene_django/tests/urls_inherited.py new file mode 100644 index 0000000..55ec18f --- /dev/null +++ b/graphene_django/tests/urls_inherited.py @@ -0,0 +1,14 @@ +from django.conf.urls import url + +from ..views import GraphQLView +from .schema_view import schema + +class CustomGraphQLView(GraphQLView): + schema = schema + graphiql = True + pretty = True + + +urlpatterns = [ + url(r'^graphql/inherited/$', CustomGraphQLView.as_view()), +]