graphene-django/graphene_django/elasticsearch/tests/test_fields.py
2019-05-31 22:16:36 -04:00

28 lines
802 B
Python

import pytest
from graphene_django.filter.tests.test_fields import assert_arguments, ArticleNode
from graphene_django.elasticsearch.tests.filters import ArticleFilterES
from graphene_django.utils import DJANGO_FILTER_INSTALLED, DJANGO_ELASTICSEARCH_DSL_INSTALLED
pytestmark = []
if DJANGO_FILTER_INSTALLED and DJANGO_ELASTICSEARCH_DSL_INSTALLED:
from graphene_django.filter import (
DjangoFilterConnectionField,
)
else:
pytestmark.append(
pytest.mark.skipif(
True, reason="django_filters not installed or not compatible"
)
)
pytestmark.append(pytest.mark.django_db)
def test_filter_string_fields():
field = DjangoFilterConnectionField(ArticleNode, filterset_class=ArticleFilterES)
assert_arguments(field, "headline", "headline_term")