Skip to content


Browse files Browse the repository at this point in the history
[api] Fix slack API disabling all other URLs
  • Loading branch information
romainr committed Jun 4, 2021
1 parent fad2ae1 commit a1ed24b
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 3 deletions.
41 changes: 41 additions & 0 deletions desktop/core/src/desktop/
@@ -0,0 +1,41 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# See the License for the specific language governing permissions and
# limitations under the License.

from import assert_true, assert_false, assert_equal, assert_not_equal, assert_raises
from django.urls import reverse

from desktop.lib.django_test_util import make_logged_in_client
from desktop.lib.test_utils import grant_access

from useradmin.models import User

class TestEditorApi():

def setUp(self):
self.client = make_logged_in_client(username="api_user", recreate=True, is_superuser=False)
self.client_not_me = make_logged_in_client(username="not_api_user", recreate=True, is_superuser=False)

self.user = User.objects.get(username="api_user")
self.user_not_me = User.objects.get(username="not_api_user")

grant_access(self.user.username, self.user.username, "desktop")
grant_access(self.user_not_me.username, self.user_not_me.username, "desktop")

def test_urls_exist(self):
assert_equal(reverse('api:editor_execute', args=['hive']), '/api/editor/execute/hive')
4 changes: 2 additions & 2 deletions desktop/core/src/desktop/
Expand Up @@ -42,7 +42,7 @@
re_path(r'^editor/create_notebook/?$', api_public.create_notebook, name='api_create_notebook'),
re_path(r'^editor/create_session/?$', api_public.create_session, name='api_create_session'),
re_path(r'^editor/close_session/?$', api_public.close_session, name='api_close_session'),
re_path(r'^editor/execute(?:/(?P<dialect>.+))?/?$', api_public.execute, name='api_execute'),
re_path(r'^editor/execute(?:/(?P<dialect>.+))?/?$', api_public.execute, name='editor_execute'),
re_path(r'^editor/check_status/?$', api_public.check_status, name='api_check_status'),
re_path(r'^editor/fetch_result_data/?$', api_public.fetch_result_data, name='api_fetch_result_data'),
re_path(r'^editor/fetch_result_metadata/?$', api_public.fetch_result_metadata, name='api_fetch_result_metadata'),
Expand Down Expand Up @@ -75,6 +75,6 @@

# Slack install API for using CORS by default
urlpatterns = [
urlpatterns += [
re_path(r'^slack/install/?$', botserver_api.generate_slack_install_link, name='botserver.api.slack_install_link'),
2 changes: 1 addition & 1 deletion desktop/core/src/desktop/
Expand Up @@ -212,7 +212,7 @@
re_path('^api/token/verify/?$', TokenVerifyView.as_view(), name='token_verify'),
re_path('^api/token/refresh/?$', TokenRefreshView.as_view(), name='token_refresh'),

re_path(r'^api/', include('desktop.api_public_urls')),
re_path(r'^api/', include(('desktop.api_public_urls', 'api'), 'api')),

dynamic_patterns += [
Expand Down

0 comments on commit a1ed24b

Please sign in to comment.