Merge "Use django.conf.settings instead of local_settings"

This commit is contained in:
Zuul 2019-09-30 12:58:35 +00:00 committed by Gerrit Code Review
commit ac9b6e163c
3 changed files with 10 additions and 4 deletions

View File

@ -19,5 +19,5 @@ from django.core.management import execute_from_command_line
if __name__ == "__main__": if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", os.environ.setdefault("DJANGO_SETTINGS_MODULE",
"openstack_dashboard.settings") "monitoring.test.settings")
execute_from_command_line(sys.argv) execute_from_command_line(sys.argv)

View File

@ -13,6 +13,7 @@
# under the License. # under the License.
from django.test import RequestFactory from django.test import RequestFactory
from django.test.utils import override_settings
from django.urls import reverse from django.urls import reverse
from monitoring.overview import constants from monitoring.overview import constants
@ -26,6 +27,12 @@ INDEX_URL = reverse(
class OverviewTest(helpers.TestCase): class OverviewTest(helpers.TestCase):
@override_settings(DASHBOARDS=[],
KIBANA_POLICY_SCOPE='monitoring',
KIBANA_POLICY_RULE='monitoring:kibana_access',
ENABLE_LOG_MANAGEMENT_BUTTON=False,
ENABLE_EVENT_MANAGEMENT_BUTTON=False,
SHOW_GRAFANA_HOME=True)
def test_index_get(self): def test_index_get(self):
res = self.client.get(INDEX_URL) res = self.client.get(INDEX_URL)
self.assertTemplateUsed( self.assertTemplateUsed(

View File

@ -17,6 +17,7 @@ import copy
import json import json
import logging import logging
from django.conf import settings
from django.contrib import messages from django.contrib import messages
from django import http from django import http
from django.http import HttpResponse from django.http import HttpResponse
@ -25,16 +26,14 @@ from django.utils.translation import ugettext_lazy as _ # noqa
from django.views.decorators.csrf import csrf_exempt from django.views.decorators.csrf import csrf_exempt
from django.views import generic from django.views import generic
from django.views.generic import TemplateView from django.views.generic import TemplateView
from horizon import exceptions
from openstack_auth import utils as auth_utils from openstack_auth import utils as auth_utils
from openstack_dashboard import policy from openstack_dashboard import policy
import six import six
from six.moves import urllib from six.moves import urllib
from horizon import exceptions
from monitoring.alarms import tables as alarm_tables from monitoring.alarms import tables as alarm_tables
from monitoring import api from monitoring import api
from monitoring.config import local_settings as settings
from monitoring.overview import constants from monitoring.overview import constants
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)