Pārlūkot izejas kodu

HUE-8737 [py3] Add back ldap module to requirements

Romain 5 gadi atpakaļ
vecāks
revīzija
170f7e907d

+ 2 - 0
desktop/core/requirements.txt

@@ -10,6 +10,7 @@ channels==2.1.6
 channels-redis==2.3.2
 configobj==5.0.6
 cryptography==2.8
+django-auth-ldap==1.3.0
 Django==1.11.28 # Django 2 then 3?
 django-axes==2.2.0
 django-celery-beat==1.4.0
@@ -42,6 +43,7 @@ pysaml2>=4.5.0
 python-crontab==2.3.6
 python-dateutil==2.4.2
 python-daemon==2.2.4
+python-ldap==3.1.0
 python-oauth2==1.1.0
 pytidylib==0.3.2
 pytz==2015.2

+ 16 - 14
desktop/libs/notebook/src/notebook/connectors/sql_alchemy_tests.py

@@ -188,28 +188,30 @@ class TestApi(object):
   def test_get_sample_data(self):
     snippet = Mock()
 
-    with patch('notebook.connectors.sql_alchemy.Assist.get_sample_data') as get_sample_data:
-      with patch('notebook.connectors.sql_alchemy.inspect') as inspect:
-        get_sample_data.return_value = (['col1'], [[1], [2]])
+    with patch('notebook.connectors.sql_alchemy.create_engine') as create_engine:
+      with patch('notebook.connectors.sql_alchemy.Assist.get_sample_data') as get_sample_data:
+        with patch('notebook.connectors.sql_alchemy.inspect') as inspect:
+          get_sample_data.return_value = (['col1'], [[1], [2]])
 
-        response = SqlAlchemyApi(self.user, self.interpreter).get_sample_data(snippet)
+          response = SqlAlchemyApi(self.user, self.interpreter).get_sample_data(snippet)
 
-        assert_equal(response['rows'], [[1], [2]])
-        assert_equal(
-          response['full_headers'],
-          [{'name': 'col1', 'type': 'STRING_TYPE', 'comment': ''}]
-        )
+          assert_equal(response['rows'], [[1], [2]])
+          assert_equal(
+            response['full_headers'],
+            [{'name': 'col1', 'type': 'STRING_TYPE', 'comment': ''}]
+          )
 
   def test_get_sample_data_table(self):
     snippet = Mock()
 
-    with patch('notebook.connectors.sql_alchemy.Assist.get_sample_data') as get_sample_data:
-      with patch('notebook.connectors.sql_alchemy.inspect') as inspect:
-        get_sample_data.return_value = (['col1'], [[1], [2]])
+    with patch('notebook.connectors.sql_alchemy.create_engine') as create_engine:
+      with patch('notebook.connectors.sql_alchemy.Assist.get_sample_data') as get_sample_data:
+        with patch('notebook.connectors.sql_alchemy.inspect') as inspect:
+          get_sample_data.return_value = (['col1'], [[1], [2]])
 
-        response = SqlAlchemyApi(self.user, self.interpreter).get_sample_data(snippet, database='database1', table='table1')
+          response = SqlAlchemyApi(self.user, self.interpreter).get_sample_data(snippet, database='database1', table='table1')
 
-        assert_equal(response['rows'], [[1], [2]])
+          assert_equal(response['rows'], [[1], [2]])
 
 
 class TestDialects(object):