Files
horizon/openstack_dashboard/test/unit/test_views.py
Shu Muto f494c6f2d4 Fix Angular errors in openstack_auth
Angular errors on login page are caused by loading ngdetails view.
Although registration of URL for ngdetails is executed on top level
of Horizon, ngdetails view is not needed to be loaded in login page,
i.e. openstack_auth side.
To fix this issue, this patch moves registration of URL for ngdetails
into openstack_dashboard side.

Change-Id: Ib039417b4e666c2341f17ac05fd7723bc758816c
Closes-Bug: #1754133
Closes-Bug: #1753557
2018-03-17 18:36:01 +09:00

53 lines
2.1 KiB
Python

# 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.
import six
from openstack_dashboard.test import helpers as test
from openstack_dashboard import views
class DashboardViewsTest(test.TestCase):
def test_get_url_with_pagination(self):
req = self.request
url_string = 'horizon:project:instances:index'
url = views.get_url_with_pagination(req, None, None, url_string, None)
self.assertEqual(six.text_type('/project/instances/'), url)
def test_get_url_with_pagination_with_if(self):
req = self.request
url_string = 'horizon:project:instances:detail'
url = views.get_url_with_pagination(req, None, None, url_string, 'id')
self.assertEqual(six.text_type('/project/instances/id/'), url)
def test_get_url_with_pagination_next(self):
req = self.request
url_string = 'horizon:project:instances:index'
req.GET.update({'next': 'id'})
url = views.get_url_with_pagination(
req, 'next', None, url_string, None)
self.assertEqual(six.text_type('/project/instances/?next=id'), url)
def test_get_url_with_pagination_prev(self):
req = self.request
url_string = 'horizon:project:instances:index'
req.GET.update({'prev': 'id'})
url = views.get_url_with_pagination(
req, None, 'prev', url_string, None)
self.assertEqual(six.text_type('/project/instances/?prev=id'), url)
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)