Akihiro Motoki 75bc2e6aa8 Remove and deprecate dashboards config from settings file
Dashboards are now configured via the pluggable dashboard/panel
mechanism and the order can be specified in the pluggable config.
On the other hand, we have HORIZON "dashboards" and its tuple order
overrides the order specified in the pluggable config.
It is confusing to be able to configure the order of dashboards
in two places, and we no longer need to have "dashboards" config
parameter in settings.py and a sample local_settings.py.

* If HORIZON_CONFIG contains "dashboards" and update_dashboards
  is called, a deprecation warning will be displayed. It is useful
  to warn operators to change OpenStack Dashboard settings.

* HORIZON_CONFIG "dashboard" parameter itself still works and
  there is no chnage in the behavior, so it is a safe change
  and have no upgrade impact.

* This change also removes default_dashboard from settings because
  it can be configured via pluggable dashboard config too.

After removing "dashboards" config, the order of the dashboards
are now controlled by the order of openstack_dashboard/enabled and
"Identity" dashboard is displayed before "Settings" dashboard
in the navigation menu.

Closes-Bug: #1366270

Change-Id: Ifa35128691c4fa4843b3c3c051682392e59905a6
2014-10-01 15:42:28 +09:00

52 lines
1.9 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 copy
from django.conf import settings
from django.test.utils import override_settings
import horizon
from openstack_dashboard.test import helpers as test
from openstack_dashboard.test.test_panels.plugin_panel \
import panel as plugin_panel
import openstack_dashboard.test.test_plugins.panel_group_config
from openstack_dashboard.utils import settings as util_settings
PANEL_GROUP_SLUG = 'plugin_panel_group'
HORIZON_CONFIG = copy.deepcopy(settings.HORIZON_CONFIG)
INSTALLED_APPS = list(settings.INSTALLED_APPS)
# NOTE: Ensure dashboards and default_dashboard are not included in
# HORIZON_CONFIG to ensure warning messages from update_dashboards below.
HORIZON_CONFIG.pop('dashboards', None)
HORIZON_CONFIG.pop('default_dashboard', None)
util_settings.update_dashboards([
openstack_dashboard.test.test_plugins.panel_group_config,
], HORIZON_CONFIG, INSTALLED_APPS)
@override_settings(HORIZON_CONFIG=HORIZON_CONFIG,
INSTALLED_APPS=INSTALLED_APPS)
class PanelGroupPluginTests(test.PluginTestCase):
def test_add_panel_group(self):
dashboard = horizon.get_dashboard("admin")
self.assertIsNotNone(dashboard.get_panel_group(PANEL_GROUP_SLUG))
def test_add_panel(self):
dashboard = horizon.get_dashboard("admin")
self.assertIn(plugin_panel.PluginPanel,
[p.__class__ for p in dashboard.get_panels()])