mirror of
https://github.com/graphql-python/graphene-django.git
synced 2025-01-31 11:48:38 +03:00
Test of inherited class
This commit is contained in:
parent
2cb3d4b68e
commit
3682fe0318
|
@ -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')
|
@pytest.mark.urls('graphene_django.tests.urls_pretty')
|
||||||
def test_supports_pretty_printing(client):
|
def test_supports_pretty_printing(client):
|
||||||
response = client.get(url_string(query='{test}'))
|
response = client.get(url_string(query='{test}'))
|
||||||
|
|
14
graphene_django/tests/urls_inherited.py
Normal file
14
graphene_django/tests/urls_inherited.py
Normal file
|
@ -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()),
|
||||||
|
]
|
Loading…
Reference in New Issue
Block a user