File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -386,6 +386,24 @@ def test_allows_post_with_get_operation_name(client):
386
386
}
387
387
388
388
389
+ @pytest .mark .urls ('graphene_django.tests.urls_inherited' )
390
+ def test_inherited_class_with_attributes_works (client ):
391
+ inherited_url = '/graphql/inherited/'
392
+ # Check schema and pretty attributes work
393
+ response = client .post (url_string (inherited_url , query = '{test}' ))
394
+ assert response .content .decode () == (
395
+ '{\n '
396
+ ' "data": {\n '
397
+ ' "test": "Hello World"\n '
398
+ ' }\n '
399
+ '}'
400
+ )
401
+
402
+ # Check graphiql works
403
+ response = client .get (url_string (inherited_url ), HTTP_ACCEPT = 'text/html' )
404
+ assert response .status_code == 200
405
+
406
+
389
407
@pytest .mark .urls ('graphene_django.tests.urls_pretty' )
390
408
def test_supports_pretty_printing (client ):
391
409
response = client .get (url_string (query = '{test}' ))
Original file line number Diff line number Diff line change
1
+ from django .conf .urls import url
2
+
3
+ from ..views import GraphQLView
4
+ from .schema_view import schema
5
+
6
+ class CustomGraphQLView (GraphQLView ):
7
+ schema = schema
8
+ graphiql = True
9
+ pretty = True
10
+
11
+
12
+ urlpatterns = [
13
+ url (r'^graphql/inherited/$' , CustomGraphQLView .as_view ()),
14
+ ]
You can’t perform that action at this time.
0 commit comments