Skip to content

Commit f0bec79

Browse files
prepare 0.7
1 parent f72d90f commit f0bec79

File tree

12 files changed

+71
-13
lines changed

12 files changed

+71
-13
lines changed

CHANGELOG.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,17 @@ are used for versioning (schema follows below):
1515
0.3.4 to 0.4).
1616
- All backwards incompatible changes are mentioned in this document.
1717

18+
0.7
19+
---
20+
2018-03-08
21+
22+
.. note::
23+
24+
Dear ladies, congratulations on `International Women's Day
25+
<https://en.wikipedia.org/wiki/International_Women%27s_Day>`_
26+
27+
- CoreAPI/CoreSchema support.
28+
1829
0.6.4
1930
-----
2031
2018-03-05

CREDITS.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ Contributors
3434
------------
3535
Thanks to the following people for their contributions:
3636

37-
- [Jean-David Fiquet](https://github.com/barseghyanartur/django-elasticsearch-dsl-drf/commits?author=id13)
37+
- `Jean-David Fiquet <https://github.com/barseghyanartur/django-elasticsearch-dsl-drf/commits?author=id13>`_
3838
for his valuable contributions to the ``geo-spatial`` features, ``highlight``
3939
backend, ``nested search`` and a number of other additions/fixes.
40+
- `Mateusz Mejsner <https://github.com/barseghyanartur/django-elasticsearch-dsl-drf/commits?author=macher91>`_
41+
for CoreAPI and CoreSchema support.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
coreapi
2+
coreschema

examples/requirements/none.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

examples/requirements/test.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ pytest-django==2.9.1
77
pytest-ordering==0.5
88
pytest==3.0.2
99
selenium==2.53.6
10-
tox==2.3.1
11-
coreapi==2.3.3
12-
coreschema==0.0.4
10+
tox==2.9.1
11+
#coreapi==2.3.3
12+
#coreschema==0.0.4

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from setuptools import find_packages, setup
44

5-
version = '0.6.4'
5+
version = '0.7'
66

77
DOCS_TRANSFORMATIONS = (
88
(

src/django_elasticsearch_dsl_drf/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"""
44

55
__title__ = 'django-elasticsearch-dsl-drf'
6-
__version__ = '0.6.4'
6+
__version__ = '0.7'
77
__author__ = 'Artur Barseghyan <[email protected]>'
88
__copyright__ = '2017-2018 Artur Barseghyan'
99
__license__ = 'GPL 2.0/LGPL 2.1'

src/django_elasticsearch_dsl_drf/tests/base.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"""
44

55
import logging
6+
import pip
67

78
from django.test import TransactionTestCase
89
import pytest
@@ -17,10 +18,23 @@
1718
__all__ = (
1819
'BaseRestFrameworkTestCase',
1920
'BaseTestCase',
21+
'INSTALLED_PACKAGES',
22+
'CORE_API_IS_INSTALLED',
23+
'CORE_SCHEMA_IS_INSTALLED',
24+
'CORE_API_AND_CORE_SCHEMA_ARE_INSTALLED',
25+
'CORE_API_AND_CORE_SCHEMA_MISSING_MSG',
2026
)
2127

2228
LOGGER = logging.getLogger(__name__)
23-
29+
_INSTALLED_PACKAGES = pip.get_installed_distributions()
30+
INSTALLED_PACKAGES = [pkg.project_name for pkg in _INSTALLED_PACKAGES]
31+
CORE_API_IS_INSTALLED = 'coreapi' in INSTALLED_PACKAGES
32+
CORE_SCHEMA_IS_INSTALLED = 'coreschema' in INSTALLED_PACKAGES
33+
CORE_API_AND_CORE_SCHEMA_ARE_INSTALLED = (
34+
CORE_API_IS_INSTALLED and CORE_SCHEMA_IS_INSTALLED
35+
)
36+
CORE_API_AND_CORE_SCHEMA_MISSING_MSG = "Skipped because coreapi or " \
37+
"coreschema are not installed!"
2438

2539
@pytest.mark.django_db
2640
class BaseRestFrameworkTestCase(TransactionTestCase):

src/django_elasticsearch_dsl_drf/tests/test_filtering_common.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,14 @@
1313
from rest_framework import status
1414

1515
from books import constants
16-
from ..filter_backends import FilteringFilterBackend
1716
from search_indexes.viewsets import BookDocumentViewSet
1817

19-
from .base import BaseRestFrameworkTestCase
18+
from ..filter_backends import FilteringFilterBackend
19+
from .base import (
20+
BaseRestFrameworkTestCase,
21+
CORE_API_AND_CORE_SCHEMA_ARE_INSTALLED,
22+
CORE_API_AND_CORE_SCHEMA_MISSING_MSG,
23+
)
2024
from .data_mixins import AddressesMixin, BooksMixin
2125

2226
__title__ = 'django_elasticsearch_dsl_drf.tests.test_filtering'
@@ -530,12 +534,16 @@ def test_various_complex_fields(self):
530534
response = self.client.get(self.city_detail_url, data)
531535
self.assertEqual(response.status_code, status.HTTP_200_OK)
532536

537+
@unittest.skipIf(not CORE_API_AND_CORE_SCHEMA_ARE_INSTALLED,
538+
CORE_API_AND_CORE_SCHEMA_MISSING_MSG)
533539
def test_schema_fields_with_filter_fields_list(self):
534540
"""Test schema field generator"""
535541
fields = self.backend.get_schema_fields(self.view)
536542
fields = [f.name for f in fields]
537543
self.assertEqual(fields, list(self.view.filter_fields.keys()))
538544

545+
@unittest.skipIf(not CORE_API_AND_CORE_SCHEMA_ARE_INSTALLED,
546+
CORE_API_AND_CORE_SCHEMA_MISSING_MSG)
539547
def test_schema_field_not_required(self):
540548
"""Test schema fields always not required"""
541549
fields = self.backend.get_schema_fields(self.view)

src/django_elasticsearch_dsl_drf/tests/test_ordering_common.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,16 @@
1414

1515
from rest_framework import status
1616

17-
import factories
1817
from django_elasticsearch_dsl_drf.filter_backends import OrderingFilterBackend
18+
19+
import factories
1920
from search_indexes.viewsets import BookDocumentViewSet
2021

21-
from .base import BaseRestFrameworkTestCase
22+
from .base import (
23+
BaseRestFrameworkTestCase,
24+
CORE_API_AND_CORE_SCHEMA_ARE_INSTALLED,
25+
CORE_API_AND_CORE_SCHEMA_MISSING_MSG,
26+
)
2227

2328
if DJANGO_GTE_1_10:
2429
from django.urls import reverse
@@ -186,12 +191,16 @@ def test_book_order_by_non_existent_field(self):
186191
self.books_url,
187192
check_ordering=False)
188193

194+
@unittest.skipIf(not CORE_API_AND_CORE_SCHEMA_ARE_INSTALLED,
195+
CORE_API_AND_CORE_SCHEMA_MISSING_MSG)
189196
def test_schema_fields_with_filter_fields_list(self):
190197
"""Test schema field generator"""
191198
fields = self.backend.get_schema_fields(self.view)
192199
fields = [f.name for f in fields]
193200
self.assertEqual(fields, ['ordering'])
194201

202+
@unittest.skipIf(not CORE_API_AND_CORE_SCHEMA_ARE_INSTALLED,
203+
CORE_API_AND_CORE_SCHEMA_MISSING_MSG)
195204
def test_schema_field_not_required(self):
196205
"""Test schema fields always not required"""
197206
fields = self.backend.get_schema_fields(self.view)

0 commit comments

Comments
 (0)