Repository: joke2k/django-environ

Issue:
Add elasticsearch7 to search scheme

Discussion:

Patch:
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index 11ecc37..b221941 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -13,6 +13,9 @@ Added
     (`#160 <https://github.com/joke2k/django-environ/issues/160>`_)
   - Added Elasticsearch5 to search scheme
     (`#297 <https://github.com/joke2k/django-environ/pull/297>`_)
+  - Added Elasticsearch7 to search scheme
+    (`#314 <https://github.com/joke2k/django-environ/pull/314>`_)
+
 
 Fixed
 +++++
diff --git a/docs/types.rst b/docs/types.rst
index 6bf1241..1e80e58 100644
--- a/docs/types.rst
+++ b/docs/types.rst
@@ -43,6 +43,7 @@ Supported types
   * Elasticsearch: ``elasticsearch://``
   * Elasticsearch2: ``elasticsearch2://``
   * Elasticsearch5: ``elasticsearch5://``
+  * Elasticsearch7: ``elasticsearch7://``
   * Solr: ``solr://``
   * Whoosh: ``whoosh://``
   * Xapian: ``xapian://``
diff --git a/environ/environ.py b/environ/environ.py
index 5d897d5..2dad620 100644
--- a/environ/environ.py
+++ b/environ/environ.py
@@ -80,7 +80,7 @@ class Env:
     URL_CLASS = ParseResult
 
     POSTGRES_FAMILY = ['postgres', 'postgresql', 'psql', 'pgsql', 'postgis']
-    ELASTICSEARCH_FAMILY = ['elasticsearch' + x for x in ['', '2', '5']]
+    ELASTICSEARCH_FAMILY = ['elasticsearch' + x for x in ['', '2', '5', '7']]
 
     DEFAULT_DATABASE_ENV = 'DATABASE_URL'
     DB_SCHEMES = {
@@ -149,6 +149,8 @@ class Env:
                           "Elasticsearch2SearchEngine",
         "elasticsearch5": "haystack.backends.elasticsearch5_backend."
                           "Elasticsearch5SearchEngine",
+        "elasticsearch7": "haystack.backends.elasticsearch7_backend."
+                          "Elasticsearch7SearchEngine",
         "solr": "haystack.backends.solr_backend.SolrEngine",
         "whoosh": "haystack.backends.whoosh_backend.WhooshEngine",
         "xapian": "haystack.backends.xapian_backend.XapianEngine",


Test patch:
diff --git a/tests/fixtures.py b/tests/fixtures.py
index db70501..f685f5c 100644
--- a/tests/fixtures.py
+++ b/tests/fixtures.py
@@ -28,7 +28,7 @@ class FakeEnv:
     EXPORTED = 'exported var'
 
     @classmethod
-    def generateData(cls):
+    def generate_data(cls):
         return dict(STR_VAR='bar',
                     MULTILINE_STR_VAR='foo\\nbar',
                     INT_VAR='42',
diff --git a/tests/test_env.py b/tests/test_env.py
index b304095..12fe9b4 100644
--- a/tests/test_env.py
+++ b/tests/test_env.py
@@ -26,7 +26,7 @@ class TestEnv:
         class.  setup_method is invoked for every test method of a class.
         """
         self.old_environ = os.environ
-        os.environ = Env.ENVIRON = FakeEnv.generateData()
+        os.environ = Env.ENVIRON = FakeEnv.generate_data()
         self.env = Env()
 
     def teardown_method(self, method):
@@ -334,7 +334,7 @@ class TestSubClass(TestEnv):
         """
         super().setup_method(method)
 
-        self.CONFIG = FakeEnv.generateData()
+        self.CONFIG = FakeEnv.generate_data()
 
         class MyEnv(Env):
             ENVIRON = self.CONFIG
diff --git a/tests/test_schema.py b/tests/test_schema.py
index ba29682..7a7f62e 100644
--- a/tests/test_schema.py
+++ b/tests/test_schema.py
@@ -19,7 +19,7 @@ def setup_module():
     global _old_environ
 
     _old_environ = os.environ
-    os.environ = Env.ENVIRON = FakeEnv.generateData()
+    os.environ = Env.ENVIRON = FakeEnv.generate_data()
 
 
 def teardown_module():
diff --git a/tests/test_search.py b/tests/test_search.py
index 6bb1117..a81471e 100644
--- a/tests/test_search.py
+++ b/tests/test_search.py
@@ -41,6 +41,8 @@ def test_solr_multicore_parsing(solr_url):
          'elasticsearch2_backend.Elasticsearch2SearchEngine'),
         ('elasticsearch5://127.0.0.1:9200/index',
          'elasticsearch5_backend.Elasticsearch5SearchEngine'),
+        ('elasticsearch7://127.0.0.1:9200/index',
+         'elasticsearch7_backend.Elasticsearch7SearchEngine'),
     ]
 )
 def test_elasticsearch_parsing(url, engine):