Skip to content

Commit

Permalink
Add tests for validation_rules inherited from parent class
Browse files Browse the repository at this point in the history
  • Loading branch information
kiendang committed Nov 23, 2023
1 parent 8eeffc7 commit 9561ec3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
6 changes: 5 additions & 1 deletion graphene_django/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,11 @@ def test_query_errors_non_atomic(set_rollback_mock, client):
set_rollback_mock.assert_not_called()


validation_urls = ["/graphql/validation/", "/graphql/validation/alternative/"]
validation_urls = [
"/graphql/validation/",
"/graphql/validation/alternative/",
"/graphql/validation/inherited/",
]

query_with_two_introspections = """
query Instrospection {
Expand Down
9 changes: 7 additions & 2 deletions graphene_django/tests/urls_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,17 @@ class View(GraphQLView):
schema = schema


class NoIntroSpectionView(View):
class NoIntrospectionView(View):
validation_rules = (DisableIntrospection,)


class NoIntrospectionViewInherited(NoIntrospectionView):
pass


urlpatterns = [
path("graphql/", View.as_view()),
path("graphql/validation/", View.as_view(validation_rules=(DisableIntrospection,))),
path("graphql/validation/alternative/", NoIntroSpectionView.as_view()),
path("graphql/validation/alternative/", NoIntrospectionView.as_view()),
path("graphql/validation/inherited/", NoIntrospectionViewInherited.as_view()),
]

0 comments on commit 9561ec3

Please sign in to comment.