[organization] dump_config test needs a default connector
@@ -42,6 +42,7 @@ from django.urls import reverse
from django.test.client import Client
from django.views.static import serve
from django.http import HttpResponse
+from mock import patch, Mock, MagicMock
from nose.plugins.attrib import attr
from nose.plugins.skip import SkipTest
from nose.tools import assert_true, assert_false, assert_equal, assert_not_equal, assert_raises, nottest
@@ -273,6 +274,15 @@ def test_dump_config():
finish = desktop.conf.ENABLE_CONNECTORS.set_for_testing(True)
try:
+ with patch('desktop.lib.connectors.api.CONNECTORS.get') as CONNECTORS:
+ CONNECTORS.return_value = {
+ 'hdfs-1': Mock(
+ NICE_NAME=Mock(get=Mock(return_value='HDFS')),
+ DIALECT=Mock(get=Mock(return_value='hdfs')),
+ INTERFACE=Mock(get=Mock(return_value='rest')),
+ SETTINGS=Mock(get=Mock(return_value=[{"name": "server_url", "value": "http://gethue.com:20101/webhdfs/v1"}])),
+ )
+ }
response = c.get(reverse('desktop.views.dump_config'))
assert_equal(1, len(response.context[0]['apps']), response.context[0])
finally:
