mirror of
https://github.com/graphql-python/graphene-django.git
synced 2024-11-22 09:37:07 +03:00
Add tests
This commit is contained in:
parent
7a765537e9
commit
cfe38ae208
26
graphene_django/tests/test_utils.py
Normal file
26
graphene_django/tests/test_utils.py
Normal file
|
@ -0,0 +1,26 @@
|
|||
|
||||
|
||||
from ..utils import get_model_fields, get_reverse_fields
|
||||
from .models import Film, Reporter
|
||||
|
||||
|
||||
def test_get_reverse_fields_correct():
|
||||
reporter_reverse_fields = get_reverse_fields(Reporter)
|
||||
reporter_field_names = [field[0] for field in reporter_reverse_fields]
|
||||
assert reporter_field_names == [
|
||||
'articles', 'films'
|
||||
]
|
||||
|
||||
film_reverse_fields = get_reverse_fields(Film)
|
||||
film_field_names = [field[0] for field in film_reverse_fields]
|
||||
assert film_field_names == ['details']
|
||||
|
||||
|
||||
def test_get_model_fields_no_duplication():
|
||||
reporter_fields = get_model_fields(Reporter)
|
||||
reporter_name_set = set([field[0] for field in reporter_fields])
|
||||
assert len(reporter_fields) == len(reporter_name_set)
|
||||
|
||||
film_fields = get_model_fields(Film)
|
||||
film_name_set = set([field[0] for field in film_fields])
|
||||
assert len(film_fields) == len(film_name_set)
|
Loading…
Reference in New Issue
Block a user