Skip to content

Commit

Permalink
Merge pull request #207 from cfpb/django42
Browse files Browse the repository at this point in the history
Update dependencies and support Django 4.2
  • Loading branch information
willbarton committed Mar 6, 2024
2 parents a63efc3 + 3f070de commit 3c83d88
Show file tree
Hide file tree
Showing 14 changed files with 44 additions and 26 deletions.
2 changes: 1 addition & 1 deletion complaint_search/tests/test_es_interface.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import copy
from datetime import datetime
from unittest import mock

from django.http import StreamingHttpResponse
from django.test import SimpleTestCase, TestCase

import mock
from elasticsearch import Elasticsearch
from parameterized import parameterized

Expand Down
3 changes: 2 additions & 1 deletion complaint_search/tests/test_es_interface_states.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from unittest import mock

from django.test import TestCase

import mock
from elasticsearch import Elasticsearch

from complaint_search.es_interface import states_agg
Expand Down
3 changes: 2 additions & 1 deletion complaint_search/tests/test_es_interface_trends.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from unittest import mock

from django.test import TestCase

import mock
from elasticsearch import Elasticsearch

from complaint_search.es_interface import trends
Expand Down
3 changes: 2 additions & 1 deletion complaint_search/tests/test_view_search_renderers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import mock
from unittest import mock

from rest_framework import status
from rest_framework.test import APITestCase

Expand Down
3 changes: 2 additions & 1 deletion complaint_search/tests/test_view_suggest_company.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from unittest import mock

from django.conf import settings
from django.urls import reverse

import mock
from elasticsearch import TransportError
from rest_framework import status
from rest_framework.test import APITestCase
Expand Down
3 changes: 2 additions & 1 deletion complaint_search/tests/test_views_document.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from unittest import mock

from django.core.cache import cache
from django.test import override_settings

import mock
from elasticsearch import TransportError
from rest_framework import status
from rest_framework.test import APITestCase
Expand Down
17 changes: 14 additions & 3 deletions complaint_search/tests/test_views_search.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import copy
from datetime import date, datetime
from unittest import mock

from django.conf import settings
from django.core.cache import cache
from django.http import StreamingHttpResponse
from django.test import override_settings

import mock
from elasticsearch import TransportError
from rest_framework import status
from rest_framework.exceptions import ErrorDetail
Expand Down Expand Up @@ -103,8 +103,19 @@ def test_search_with_format(self, mock_essearch, mock_dt):
),
)
self.assertTrue(isinstance(response, StreamingHttpResponse))
mock_essearch.has_calls(
[mock.call(format=k) for k in FORMAT_CONTENT_TYPE_MAP],

mock_essearch.assert_has_calls(
[mock.call(
format=k,
agg_exclude=mock.ANY,
field=mock.ANY,
size=mock.ANY,
frm=mock.ANY,
sort=mock.ANY,
page=mock.ANY,
no_aggs=mock.ANY,
no_highlight=mock.ANY,
) for k in FORMAT_CONTENT_TYPE_MAP],
any_order=True,
)
self.assertEqual(
Expand Down
2 changes: 1 addition & 1 deletion complaint_search/tests/test_views_states.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import copy
from unittest import mock

import mock
from parameterized import parameterized
from rest_framework import status
from rest_framework.test import APITestCase
Expand Down
3 changes: 2 additions & 1 deletion complaint_search/tests/test_views_suggest.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from unittest import mock

from django.conf import settings

import mock
from elasticsearch import TransportError
from rest_framework import status
from rest_framework.test import APITestCase
Expand Down
3 changes: 2 additions & 1 deletion complaint_search/tests/test_views_suggest_company.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from unittest import mock

from django.conf import settings

import mock
from elasticsearch import TransportError
from rest_framework import status
from rest_framework.test import APITestCase
Expand Down
3 changes: 2 additions & 1 deletion complaint_search/tests/test_views_suggest_zip.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from unittest import mock

from django.conf import settings

import mock
from elasticsearch import TransportError
from rest_framework import status
from rest_framework.test import APITestCase
Expand Down
2 changes: 1 addition & 1 deletion complaint_search/tests/test_views_trends.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import copy
from unittest import mock

import mock
from rest_framework import status
from rest_framework.test import APITestCase

Expand Down
17 changes: 8 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,23 +48,22 @@ def get_git_version():


install_requires = [
"Django>=3.2,<3.3",
"djangorestframework>=3.9.1,<4.0",
"Django>=3.2,<4.3",
"djangorestframework>=3.14,<4.0",
"django-rest-swagger>=2.2.0",
"requests>=2.18,<3",
"requests>=2.31,<3",
"elasticsearch>=7.0.0,<7.11",
"django-localflavor>=1.1,<3.1",
"django-localflavor>=4.0,<5.0",
"django-flags>=4.0.1,<5.1",
"requests-aws4auth",
]

testing_extras = [
"coverage>=4.5.1,<5",
"mock==2.0.0",
"coverage>=7.4,<8",
"deep==0.10",
"deepdiff>=3.3,<5.0",
"django-nose==1.4.1",
"parameterized==0.6.1",
"deepdiff>=6.7,<7",
"django-nose==1.4.7",
"parameterized==0.9.0",
"elasticsearch7>=7.0.0,<8.0.0",
"requests-aws4auth",
]
Expand Down
6 changes: 3 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[tox]
skipsdist=True
envlist=lint,py{38}-dj{32}
envlist=lint,py38-dj{32,42}

[testenv]
basepython=
py38: python3.8
basepython=python3.8
deps=
dj32: Django>=3.2,<3.3
dj42: Django>=4.2,<4.3

install_command=pip install -e ".[testing]" -U {opts} {packages}
setenv=
Expand Down

0 comments on commit 3c83d88

Please sign in to comment.