mirror of
https://github.com/graphql-python/graphene-django.git
synced 2025-07-13 17:52:19 +03:00
Adding testing for graphene_django/elasticsearch/*
This commit is contained in:
parent
4796d024d4
commit
fc186ea23d
0
graphene_django/elasticsearch/tests/__init__.py
Normal file
0
graphene_django/elasticsearch/tests/__init__.py
Normal file
8
graphene_django/elasticsearch/tests/filters.py
Normal file
8
graphene_django/elasticsearch/tests/filters.py
Normal file
|
@ -0,0 +1,8 @@
|
|||
|
||||
from graphene_django.elasticsearch.filter import filters
|
||||
from graphene_django.elasticsearch.filter.filterset import FilterSetES
|
||||
|
||||
|
||||
class ArticleFilterES(FilterSetES):
|
||||
|
||||
headline = filters.StringFilterES(attr='headline')
|
27
graphene_django/elasticsearch/tests/test_fields.py
Normal file
27
graphene_django/elasticsearch/tests/test_fields.py
Normal file
|
@ -0,0 +1,27 @@
|
|||
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")
|
|
@ -13,7 +13,7 @@ except ImportError:
|
|||
|
||||
|
||||
try:
|
||||
import django_elasticsearch_dsl # noqa
|
||||
import elasticsearch_dsl # noqa
|
||||
|
||||
DJANGO_ELASTICSEARCH_DSL_INSTALLED = True
|
||||
except ImportError:
|
||||
|
|
Loading…
Reference in New Issue
Block a user