Merge "Fix Angular errors in openstack_auth" into stable/ocata

This commit is contained in:
Zuul 2019-04-23 08:29:40 +00:00 committed by Gerrit Code Review
commit bef5eaef67
5 changed files with 38 additions and 13 deletions

View File

@ -865,13 +865,6 @@ class Site(Registry, HorizonComponent):
urlpatterns.append(url(r'^%s/' % dash.slug,
include(dash._decorated_urls)))
# add URL for ngdetails
views = import_module('horizon.browsers.views')
urlpatterns.append(url(r'^ngdetails/',
views.AngularDetailsView.as_view(),
name='ngdetails'))
_decorate_urlconf(urlpatterns, require_auth)
# Return the three arguments to django.conf.urls.include
return urlpatterns, self.namespace, self.slug

View File

@ -326,12 +326,6 @@ class HorizonTests(BaseHorizonTests):
# Restore settings
settings.SECURE_PROXY_SSL_HEADER = None
def test_urls_ngdetails(self):
resp = self.client.get("/ngdetails/")
self.assertEqual(200, resp.status_code)
resp = self.client.get("/ngdetails/OS::Glance::Image/xxxxx-xxx")
self.assertEqual(200, resp.status_code)
class GetUserHomeTests(BaseHorizonTests):
"""Test get_user_home parameters."""

View File

@ -24,6 +24,8 @@ from django.conf.urls import url
from django.contrib.staticfiles.urls import staticfiles_urlpatterns # noqa
from django.views import defaults
from horizon.browsers import views as browsers_views
from openstack_dashboard.api import rest
from openstack_dashboard.test.jasmine import jasmine
from openstack_dashboard import views
@ -36,6 +38,9 @@ urlpatterns = [
url(r'^api/', include(rest.urls)),
url(r'^jasmine/(.*?)$', jasmine.dispatcher),
url(r'', include(horizon.urls)),
url(r'^project/ngdetails/',
browsers_views.AngularDetailsView.as_view(),
name='ngdetails'),
]
# Development static app and project media serving using the staticfiles app.

View File

@ -0,0 +1,23 @@
# Licensed 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from openstack_dashboard.test import helpers as test
class DashboardViewsTest(test.TestCase):
def test_urls_ngdetails(self):
resp = self.client.get("/project/ngdetails/")
self.assertEqual(200, resp.status_code)
resp = self.client.get("/project/ngdetails/"
"OS::Glance::Image/xxxxx-xxx")
self.assertEqual(200, resp.status_code)

View File

@ -28,6 +28,9 @@ from django.contrib.staticfiles.urls import staticfiles_urlpatterns # noqa
from django.views import defaults
import horizon
import horizon.base
from horizon.browsers import views as browsers_views
from horizon.decorators import require_auth
from openstack_dashboard.api import rest
from openstack_dashboard import views
@ -38,6 +41,13 @@ urlpatterns = [
url(r'', include(horizon.urls)),
]
# add URL for ngdetails
ngdetails_url = url(r'^project/ngdetails/',
browsers_views.AngularDetailsView.as_view(),
name='ngdetails')
urlpatterns.append(ngdetails_url)
horizon.base._decorate_urlconf([ngdetails_url], require_auth)
for u in getattr(settings, 'AUTHENTICATION_URLS', ['openstack_auth.urls']):
urlpatterns.append(url(r'^auth/', include(u)))