|
@@ -734,14 +734,14 @@ class TestInstallAppExampleAPI:
|
|
|
response = install_app_examples(request)
|
|
response = install_app_examples(request)
|
|
|
|
|
|
|
|
assert response.status_code == 400
|
|
assert response.status_code == 400
|
|
|
- assert response.content.decode('utf-8') == 'Missing parameter: app_name is required.'
|
|
|
|
|
|
|
+ assert json.loads(response.content.decode('utf-8'))['message'] == 'Missing parameter: app_name is required.'
|
|
|
|
|
|
|
|
def test_install_app_examples_unsupported_app_name(self):
|
|
def test_install_app_examples_unsupported_app_name(self):
|
|
|
request = Mock(method='POST', POST={'app_name': 'test_app'}, user=Mock())
|
|
request = Mock(method='POST', POST={'app_name': 'test_app'}, user=Mock())
|
|
|
response = install_app_examples(request)
|
|
response = install_app_examples(request)
|
|
|
|
|
|
|
|
assert response.status_code == 400
|
|
assert response.status_code == 400
|
|
|
- assert response.content.decode('utf-8') == 'Unsupported app name: test_app'
|
|
|
|
|
|
|
+ assert json.loads(response.content.decode('utf-8'))['message'] == 'Unsupported app name: test_app'
|
|
|
|
|
|
|
|
def test_install_app_examples_non_admin_user(self):
|
|
def test_install_app_examples_non_admin_user(self):
|
|
|
with patch('desktop.api2.is_admin') as mock_is_admin:
|
|
with patch('desktop.api2.is_admin') as mock_is_admin:
|
|
@@ -751,7 +751,7 @@ class TestInstallAppExampleAPI:
|
|
|
response = install_app_examples(request)
|
|
response = install_app_examples(request)
|
|
|
|
|
|
|
|
assert response.status_code == 403
|
|
assert response.status_code == 403
|
|
|
- assert response.content.decode('utf-8') == 'You must be a Hue admin to access this endpoint.'
|
|
|
|
|
|
|
+ assert json.loads(response.content.decode('utf-8'))['message'] == 'You must be a Hue admin to access this endpoint.'
|
|
|
|
|
|
|
|
def test_install_app_examples_success_hive(self):
|
|
def test_install_app_examples_success_hive(self):
|
|
|
with patch('desktop.api2.is_admin') as mock_is_admin:
|
|
with patch('desktop.api2.is_admin') as mock_is_admin:
|
|
@@ -763,7 +763,7 @@ class TestInstallAppExampleAPI:
|
|
|
response = install_app_examples(request)
|
|
response = install_app_examples(request)
|
|
|
|
|
|
|
|
assert response.status_code == 200
|
|
assert response.status_code == 200
|
|
|
- assert response.content.decode('utf-8') == 'Successfully installed examples for hive.'
|
|
|
|
|
|
|
+ assert json.loads(response.content.decode('utf-8'))['message'] == 'Successfully installed examples for hive.'
|
|
|
|
|
|
|
|
def test_install_app_examples_success_impala(self):
|
|
def test_install_app_examples_success_impala(self):
|
|
|
with patch('desktop.api2.is_admin') as mock_is_admin:
|
|
with patch('desktop.api2.is_admin') as mock_is_admin:
|
|
@@ -775,14 +775,14 @@ class TestInstallAppExampleAPI:
|
|
|
response = install_app_examples(request)
|
|
response = install_app_examples(request)
|
|
|
|
|
|
|
|
assert response.status_code == 200
|
|
assert response.status_code == 200
|
|
|
- assert response.content.decode('utf-8') == 'Successfully installed examples for impala.'
|
|
|
|
|
|
|
+ assert json.loads(response.content.decode('utf-8'))['message'] == 'Successfully installed examples for impala.'
|
|
|
|
|
|
|
|
def test_setup_hive_impala_examples_invalid_dialect(self):
|
|
def test_setup_hive_impala_examples_invalid_dialect(self):
|
|
|
request = Mock(method='POST', POST={'app_name': 'impala', 'dialect': 'test_dialect'})
|
|
request = Mock(method='POST', POST={'app_name': 'impala', 'dialect': 'test_dialect'})
|
|
|
response = _setup_hive_impala_examples(request)
|
|
response = _setup_hive_impala_examples(request)
|
|
|
|
|
|
|
|
assert response.status_code == 400
|
|
assert response.status_code == 400
|
|
|
- assert response.content.decode('utf-8') == "Invalid dialect: Must be 'hive' or 'impala'"
|
|
|
|
|
|
|
+ assert json.loads(response.content.decode('utf-8'))['message'] == "Invalid dialect: Must be 'hive' or 'impala'"
|
|
|
|
|
|
|
|
def test_setup_hive_impala_examples_calls_command(self):
|
|
def test_setup_hive_impala_examples_calls_command(self):
|
|
|
with patch('desktop.api2.common.find_compute') as mock_find_compute:
|
|
with patch('desktop.api2.common.find_compute') as mock_find_compute:
|
|
@@ -801,7 +801,7 @@ class TestInstallAppExampleAPI:
|
|
|
response = _setup_notebook_examples(request)
|
|
response = _setup_notebook_examples(request)
|
|
|
|
|
|
|
|
assert response.status_code == 400
|
|
assert response.status_code == 400
|
|
|
- assert response.content.decode('utf-8') == 'Missing parameter: connector_id is required.'
|
|
|
|
|
|
|
+ assert json.loads(response.content.decode('utf-8'))['message'] == 'Missing parameter: connector_id is required.'
|
|
|
|
|
|
|
|
def test_setup_notebook_examples_existing_connector(self):
|
|
def test_setup_notebook_examples_existing_connector(self):
|
|
|
with patch('desktop.api2.Connector.objects.get') as mock_get_connector:
|
|
with patch('desktop.api2.Connector.objects.get') as mock_get_connector:
|