mirror of
https://github.com/graphql-python/graphene-django.git
synced 2025-07-11 00:32:24 +03:00
tests: added queries count check
This commit is contained in:
parent
013dbbefc6
commit
a2a95a4b62
|
@ -483,7 +483,7 @@ class TestShouldCallGetQuerySetOnOneToOne:
|
|||
assert len(result.errors) == 1
|
||||
assert result.errors[0].message == "Not authorized to access film details."
|
||||
|
||||
def test_get_queryset_called_on_foreignkey(self):
|
||||
def test_get_queryset_called_on_foreignkey(self, django_assert_num_queries):
|
||||
# A user tries to access a film details through a film
|
||||
query = """
|
||||
query getFilm($id: ID!) {
|
||||
|
@ -497,6 +497,7 @@ class TestShouldCallGetQuerySetOnOneToOne:
|
|||
"""
|
||||
|
||||
# With `permission_get_film_details`
|
||||
with django_assert_num_queries(2):
|
||||
result = self.schema.execute(
|
||||
query,
|
||||
variables={"id": self.films[0].id},
|
||||
|
@ -512,6 +513,7 @@ class TestShouldCallGetQuerySetOnOneToOne:
|
|||
}
|
||||
|
||||
# Without `permission_get_film_details`
|
||||
with django_assert_num_queries(1):
|
||||
result = self.schema.execute(
|
||||
query,
|
||||
variables={"id": self.films[0].id},
|
||||
|
@ -536,6 +538,7 @@ class TestShouldCallGetQuerySetOnOneToOne:
|
|||
"""
|
||||
|
||||
# With `permission_get_film`
|
||||
with django_assert_num_queries(2):
|
||||
result = self.schema.execute(
|
||||
query,
|
||||
variables={"id": self.film_details[0].id},
|
||||
|
@ -551,6 +554,7 @@ class TestShouldCallGetQuerySetOnOneToOne:
|
|||
}
|
||||
|
||||
# Without `permission_get_film`
|
||||
with django_assert_num_queries(1):
|
||||
result = self.schema.execute(
|
||||
query,
|
||||
variables={"id": self.film_details[1].id},
|
||||
|
|
Loading…
Reference in New Issue
Block a user